"Key is pressed" error?

This forum is currently in read-only mode.
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • couldnt you just put the key is pressed event below the event which selects the sub menu item? that way on that frame update only the selection of that frame will be made, then you could just put a new one before the event which says key is pressed and sub menu is open,

    order is everything, thats why lots of stuff made in mmf2 gets screwed up easily, those damn checks!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I always just do it like this:

    +On key is pressed
    +Value "press" is equal to 0
    +Other condition
      -Do stuff
      -Set value "press" to 1
    
    Repeat for as many switch states as you need.
    After your switch events, add this:
    
    +Always
      -Set value "press" to 0
    [/code:3e39xori]
    
    That way it runs top to bottom, only triggers the switch if a previous switch hasn't been triggered, and resets itself after checking all the switch conditions.
  • 'ELSE' in a subevent might be handy here, something along the lines of...

    + On 'Enter' pressed

    ----+ Value = 1

    ----> Set Value to 0 (and do other stuff)

    ----+ ELSE

    ----> Set Value to 1 (and do other stuff)

    This way is completely contained inside the event, and won't suffer the fall-through behavior.

  • Or yet another way, if key is down and trigger once.

  • Trigger once wasn't working for me when I tried it, either at the top or bottom. Unless you're thinking something different.

  • It works on my machine.

    Key space is down

    Trigger once

    Sprite: Rotate 10 degrees clockwise

  • It works on my machine.

    Key space is down

    Trigger once

    Sprite: Rotate 10 degrees clockwise

    Put another event right after it that says

    Key space is down

    Trigger once

    Sprite: Rotate 10 degrees counter-clockwise

    It won't work. Trigger once is specific to the event it's in, not what type of event is occurring. So if you have two "Space is down, trigger once" events in a row, it will trigger them both... once.

  • It works in that case, but doesn't for the numbers it seems.

    deadeye beat me!

  • I finally solved it!

    It took me hours to get it right.

    I hope this helps anybody who is having problems with this.

    http://www.fileshack.us/get_file.php?id ... nuTest.cap

    Tags for forum search: game menu, sub-menu

  • i was trying to work out a bug in my game and am now convinced it's related to this problem and even my implementation of a fix. so i'll be trying to utilize 'ELSE', as described by ashley -- i'll report back if it helped or not.

    this behavior might not be a bug, but it's looking like a slippery slope to avoid -- and there's no real way of knowning to avoid it coming in.

    edit: well, my problem doesn't seem to be related to this (i couldn't fix it, and i forgot i'd already done a more direct way of troubleshooting my bug...), so i'll probably create a new thread later. but i did find the beauty of sub-events

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