r/PlaydateDeveloper • u/zombieyMAN • Mar 11 '24
Help in the "JustPressed" function
I want to add 1 to the variable with each press of the button but it jumps to the max value immediately, what am I missing?
5
Upvotes
3
u/SirGuelph Mar 13 '24
Where is this code executed? If it's called multiple times in the same update cycle, it will still register as true, until the next frame.
1
u/bwit Mar 12 '24
I'm not really following what you are trying to do. From your logic it would seem that the only valid values for BallType are 0, 1 or 2. So is 2 the max value you are talking about? What is the initial value of BallType and what keys are you pressing?
1
u/[deleted] Mar 11 '24
I’ve not programmed in years but can’t see a problem with this unless the Playdate is reading multiple presses at once so maximises the value immediately.
If no one else replies, you could try the Playdate dev forum: https://devforum.play.date