❔ Code is completely skipping over an area
I'm writing a script for a game where if you don't press Spacebar within 4 seconds, the number of failures increase by 1, the sprite is changes, and the timer resets. This is supposed to happen twice if the button is missed, and if it happens a 3rd time, I want the GameOverScene to appear. What's happening is it directly goes to the GameOverScene when I miss the button and I'm unsure why it's missing the whole sprite change and reset timer aspect
3 Replies
i'm really new to this
nvm i think i figured it out ^_^ just sprites aren't changing grrrr
you are using the Input.GetKey function, use the Input.GetKeyDown function instead..
GetKey will return true whenever the key is being pressed while GetKeyDown will return true only once (when you press the key)
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.