Compare Variables in Actions?

0 favourites
  • 11 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • 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.

  • 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

  • Is this what you are trying to do?

    Quick example:

    Cooldown.capx (r97)

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

    I'll post more detail if not :).

  • That is exactly it, thank you. Just need to study up to make sure I understand it.

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Yup, reading it cleared it up and put all kinds of new ideas into my head :).

  • Usually to handle fire rate stuff I do things like that:

    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
  • Awesome, thanks.

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