How can I make a button do different actions at different times?

0 favourites
  • 5 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I'm trying to make a game with a somewhat interesting title screen. Title fades in, you press space, a sound plays and the title fades out, simplicity itself.

    When I make a new slide for the title screen (info about the game that also fades in) though, I can't use space to also make that title screen progress, if that makes sense. If the condition of both of them is to do X when I press space, the info has already faded out before I can read it. I know I can just make the conditions two different buttons, but that'll end up being too cumbersome and when the game actually starts, the sound effects etc will still play if the button is pressed.

    So my question is, how do I make a button perform different actions? Is there a way to be like "press space once and this happens, press it again and this happens, and afterwards it becomes pointless to press" etc. Sorry if I've worded it weirdly, I'm equally confused about how to sort this out.

  • On button pressed, if var= something then run events and add 1 to var. So every time you press the button the variable will equal 0 then 1 then 2 and you add the actions as you need for each subsequent press.

  • How can I set different functions to happen when the variable is at different values? I've made a global variable of 0 but I'm not sure where to go from there.

  • Like the condition for the button press, you can create sub event conditions, indented in the same event. Then you would add conditions if var=0, if var=1 etc Then on the actions for those you would run whatever you needed on each press and add 1 to var for the next time.

    So to be clear, not as simple as adding a condition to the main button press condition but if you press S and indent the block you can create your sub conditions there which are listed and come after the button press in the same event. Each time you press it, the variable will be different and run different actions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add me on discord ZtarDuzt#8322 ill show u how

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