How do I tie a special ability to an item?

0 favourites
  • 3 posts
From the Asset Store
A collection of various soldier character sprites for creating a 2D platformer or sidescroller game
  • Hello there,

    Im hoping this is a really simple question. Im new to programming so forgive me for any silly follow up questions. I created a dash ability for my character using the Bullet Behavior (See below). I want this special ability disabled until an in-game item is collected. Ive tried to add an on collision with my test item as the first event in this dash block but that didn't work. Is there a good way to tie the dash ability I created to an an item?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • A simple way is to create a boolean instance variable on your player object called "dash_ready". Make sure it is set to false initially.

    You can then use on player collision with trigger object - Set player "dash_ready" true.

    In your event 12 add the condition at the top "Player Dash=true". This means that the events will only occur if the player has picked up the dash ability.

    I would also add the timer behaviour to your player and on the b button pressed event, start the timer once for X seconds and call it "dash_cooldown". Then add the condition: player is timer "dash_cooldown" running (inverted) to the top event.

    This will stop the player from being able to infinitely dash.

    As for your other events you could improve them by moving your disable bullet action to the top level else event and delete the two sub conditions of the else event.

    The else will trigger if the platform object isn't jumping or falling so there is no need for the is on floor condition.

    I would also not disable the bullet behaviour on the b button released unless you intend for the player to have to hold the b button while dashing? otherwise it will cancel the dash as soon as it is released.

  • That works amazing! Thank you so much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)