How do I end a powerup

Get help using Construct 2

Post » Wed Jul 16, 2014 9:20 pm

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.
B
4
Posts: 4
Reputation: 222

Post » Wed Jul 16, 2014 11:26 pm

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...
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Thu Jul 17, 2014 9:29 am

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.
B
4
Posts: 4
Reputation: 222

Post » Thu Jul 17, 2014 9:44 am

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 17, 2014 10:55 am

I agree with @LittleStain , easy and clean way.

Similar to @jobel which is clean and easy as well. ;)
Hire or Offer a project

Portfolio

Scirra new Shop
B
34
S
5
G
1
Posts: 118
Reputation: 2,663

Post » Thu Jul 17, 2014 1:01 pm

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.
B
4
Posts: 4
Reputation: 222

Post » Thu Jul 17, 2014 1:07 pm

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)
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Thu Jul 17, 2014 1:21 pm

Sweet, thanks lolpaca! That did just the trick..... Thanks everyone!
B
4
Posts: 4
Reputation: 222


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests