Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How do I make the player close an image with action key?

I'm stuck on my game. I've made it where an event opens and shows a picture. I'd like to make it where the player can close this picture at any time by pressing the actionkey (space) within the event and the event contines as normal. I have no clue how to do this.

Can anyone please help me? If you could, please post a simple screenshot or just write it out step-by-step please...

Thank you very much!
 
I think the best way to do this, would depend on how you are making the event. I think you can make a loop section of the event that checks inside of it to see if the player is pressing the enter key. If you did it would look like this:

Loop
Conditional Branch: Is player pressing C Key?
  If yes:
    Erase Picture #whatever
    Jump to Label: Yes  #Call it whatever you want
  If No:
    #Do nothing...
  branch end
wait 1 frame
end loop
Label "Yes" Change to whatever you set it to above....
continue on with event...

I'm pretty sure that this will work. Not 100% as I can't test it now, but if you have any probs, let me know!
 
You could also use the "Break Loop" function, instead of the "Jump to Label". Another alternative would be the "Button Input Processing" command, if you're using XP. It automatically stores button input into a variable. You can then use a Conditional Branch to see if it equals a certain value (check which values correspond to which buttons by "Right click->What's this?"). Put the "Erase Picture" in the Conditional Branch and continue with the event.
 
I'm going to assume it's XP.

So you've got a show picture command, this is simple.

Create a parralell process event on the map and put this in:

Key input processing (put into a variable)

Conditional Branch > Key input cariable is = the number corressponding to they key you want pressed (see below)
Erase picture
End Event processsing

End

As a parralell process this will loop until the spacebar is pressed. Also, i'm assuming that you want the picture to show up whenever you enter the map.

As for key input processing, if you search the forums you should find what number = what key.

Hope this helps.

Peace
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top