46
Ask a Question / Re: Simulating a key press not quite working
« on: June 21, 2022, 05:34:51 am »
Probably due to the order that things happen.
If the updating event in your jump code happens first, it'll look like this.
This is the problem with using simulated presses. Sometimes you end up missing them because the press isn't simulated until after you've checked for the key press. You could try simulating the key press in a scene behavior or event, since those get updated before actor behaviors/events.
If the updating event in your jump code happens first, it'll look like this.
Code: [Select]
- Jump Code:
- when updating
- if up was pressed (is false)
- On Screen Button Code:
- when the mouse is pressed on self
- simulate key press using up (if up was pressed would return true only if it happened after this)
This is the problem with using simulated presses. Sometimes you end up missing them because the press isn't simulated until after you've checked for the key press. You could try simulating the key press in a scene behavior or event, since those get updated before actor behaviors/events.