How do I end a powerup

0 favourites
  • 8 posts
  • Hello people,

    Im fairly new to this but getting to grips quite quick, wondering if someone could help me with this.

    This is what I have -

    The player has 2 power-ups

    Only activated by pressing P (keyboard)

    Boolean (powerups) set to false at the moment

    I also have it to subtract 1 from the powerups

    This is what I want

    I want the power-ups to be available at random times through out the game (Until dead of course)

    When the powerups have been used they reset and then become active again at another random time throughout the game.

    Thanks in advance, would be great if someone could point me in the right direction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • there are a number of ways to do it.. but one off the top of my head is to give the player the Timer behavior

    Then Start a Timer (one-time) for random(seconds).

    Make an Event.. On Timer Finished to make the power up available. (set your bool to true).

    Then you need to have a condition or code block that executes when the power up has been used..in there restart the timer...repeat...

  • Hi Jobel,

    Thanks for jumping in, I appreciate it. BUT could you be a little clearer for me, I am still fairly new to this. Where can I set a timer, do I set this as an event etc ?

    Thanks again.

  • Give the player Timer behaviour..

    Set the timer for a random period

    on timer end make powerup available..

    To learn more about the timer behaviour, please refer to the manual..

  • I agree with LittleStain , easy and clean way.

    Similar to jobel which is clean and easy as well.

  • Cmon boys don't be like some tech support company "Check the manual" "have ya tried switching it on & off".....

    Thanks for the pointers though, I did manage to go another route which works fine, BUT now I have something similar Im trying to figure out and yeah its including the timer.....

    This is what I have -

    System - every 5 seconds - Create object sprite HealthUp at random positions (I also created a timer behavior for this sprite )

    What I want to do is have the sprite appear for say 5 seconds then disappear, can i use the timer behavior I assigned to achieve this?

    There appearing OK, I just cant get them to disappear.

    Thanks again for the pointers and the help, much appreciated.

  • For the disappearing thing, I'd use

    (HealthUp) On Created

    Wait 5 seconds

    Destroy

    (Wait is a System expression - any events after 'Wait X seconds' in a block will trigger after that period of time)

  • Sweet, thanks lolpaca! That did just the trick..... Thanks everyone!

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