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!
Posts: 8
Reputation: 1,991

Post » Fri Mar 03, 2017 11:15 am


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
Posts: 509
Reputation: 7,272

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests