Thanks your hint, I think the problem where in display function.
when I only use single direction sign, Not the problem.
But I use two signs together, the problem will appear
unfortunately, my problem is the plane isn’t moving.
just likes the plane not moving when I fast press right button after pressing left button. in a little odds.
The only two reasons I can think that it wouldn’t be moving are:
the pokitto buttons aren’t being updated (i.e. Pokitto::Core::update() isn’t being called)
move isn’t being called.
clear is being called when it shouldn’t be
When left and right are pressed at the same time, xaxis -= AIRCRAFT_SPEED; and xaxis += AIRCRAFT_SPEED; cancel out ((x - 4 + 4) == (x + 0) == x),
and the sprite is drawn facing left beccause:
That is just display problem.
But the plane still there when I only hold one direction sometimes. And I released the button and hold again, the plane can move.
I think that means some value not changed. Or the button’s electric noise???
If the rectangles match the plane movement, the problem is not with your code.
If rectangles do not match the plane, something else in your code is interfering with your plane.
I know it’s possible under certain circumstances to be holding one of the dpad directions and for it to not be registered as 1 in Pokitto::heldStates.
It’s not particularly common but it happens.
It’s hard to tell exactly what the circumstances are though, it happens occaisionally when pressing lots of dpad directions in quick succession.
When it happens, say for example left is held down but the corresponding entry in heldStates is 0, you’d still be able to get up and down to register by pressing on up and down without letting go of left, but left won’t register as 1 until you let go and press it again.
Originally I thought it was the dpad being unable to hold a button down under certain circumstances, but upon looking at the button code I’m beginning to suspect the issue could be that the Pokitto can only handle a certain number of interrupts at a time, and having too many at once causes some interrupts to be dropped from the queue.
(I tried marking heldStates as volatile as a precaution, but the button situation still happened.)