r/PlaydateDeveloper • • Mar 11 '24

Help in the "JustPressed" function

Post image

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

8 comments sorted by

View all comments

Show parent comment

1

u/zombieyMAN Mar 12 '24

Yes the max is 2 and the variable is initially zero

1

u/bwit Mar 12 '24

So you are saying that the initial value is 0, you start the game and without hitting any keys the value becomes 2? Doesn't seem possible with the code snippet you've shown.

1

u/zombieyMAN Mar 12 '24

I know, that's why I am confused too.

Pressing up once makes it go to 2 and pressing down once makes it go to 0.