How do I stop this Dash/Air Dash from being infinite?

Get help using Construct 2

Post » Fri Mar 03, 2017 8:05 am

I'm messing with this code I got from someone's tutorial long time ago and once "implemented" cannot make it not being infinite, basically the player
can spam it and fly forever. I just want sort of a cooldown while "on floor", and only one dash while "on jump/fall" until the player lands.

Sorry I supose is a very basic question for you guys but I'm barely starting to get in seriously with this great engine.

This is how it looks, please if someone can guide/help me will be great! Thanks!

https://drive.google.com/file/d/0B2KIEyx5yjS5Yzk0b2tUY1lGYnc/view?usp=sharing
B
13
S
5
G
2
Posts: 8
Reputation: 1,991

Post » Fri Mar 03, 2017 11:15 am

@chosensha

To prevent the player from doing more than one Dash:
Add a boolean instance variable to the Player object called CanDash, set it to true initially

Add a condition to the Dash event: Player.CanDash is true
Add an action to the Dash event: Set Player.CanDash = false

To re-enable the Dash, on landing:
[c] Player On landed
[a] Set Player.CanDash = true

To re-enable the Dash, when on the floor:
[c] Player.CanDash = false
[c] Player Is On Floor
[a] Wait DashCooldownTime seconds
[a] Set Player.CanDash = true

Alternatively, you could look at using the Timer behaviour for re-enabling the Dash
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 479
Reputation: 7,023


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 16 guests