Compare Variables in Actions?

Get help using Construct 2

Post » Tue Jul 03, 2012 10:10 pm

Hello All, I'm new to construct and a long time GameMaker user. So far I am loving Construct. One little thing I just can't figure out so here is what I am trying to do.

My main character fires 2 bullets at once, one up and one to the right. I want the one fired to the right to only be able to be fired every few seconds or so.

I have a global Variable, FireRate

I have a system event, every 1 second add 1 to FireRate

System Event- KeyPress - Space. Under the action I want to know if FireRate is >= 2. If it is, then fire the bullet and reset FireRate.

I can't seem to find simple way to do this. I assume I am missing something simple.

Thanks.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Tue Jul 03, 2012 10:16 pm

i really don't see any problem here anyway can you do a picture or explain more step by step like if you click x what you want it to do??

anyway if you wanna hold on keys try to use condition : key is down not key is pressed
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Tue Jul 03, 2012 10:22 pm

Is this what you are trying to do?

Quick example:
Cooldown.capx (r97)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jul 04, 2012 12:50 am

I'm downloading r97 now and I will let you know. Thanks.

I'll post more detail if not :).
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Jul 04, 2012 12:55 am

That is exactly it, thank you. Just need to study up to make sure I understand it.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Jul 04, 2012 12:59 am

OK, real quick. On step 3 in the event you have 2 events. Does this mean both of those events need to be true to continue? I didn't know you could do that, but that's pretty awesome.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Jul 04, 2012 1:20 am

Yeah, two conditions in one event means both have to be true to for the actions to run. If you select an event and press "Y", you turn it into an OR-block. If you have two conditions in an OR-block it will run the actions if one of the conditions are true.Nimtrix2012-07-04 01:22:16
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jul 04, 2012 1:50 am

@ArcadEd: you might want to check the manual entry about how events work as well as most of the events entries.

Let us know if reading the manual helps.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,786

Post » Wed Jul 04, 2012 2:53 am

Yup, reading it cleared it up and put all kinds of new ideas into my head :).
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Jul 04, 2012 8:47 am

Usually to handle fire rate stuff I do things like that:
[code]global number firerate = 0.4. // in seconds
global number firetimer = 0
+every ticks
-> set firetimer to max(0,firetimer-dt)
+on space pressed
+firetimer = 0
-> set firetimer to firerate
-> create bullet[/code]Yann2012-07-04 08:49:43
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Next

Return to How do I....?

Who is online

Users browsing this forum: amarcelo, Draconinho, LeFuji, plinkie, totoe and 20 guests