In this project we are demonstrating a simple animation of a guy walking like in easy but added the ability to press the A button to make the guy jump.
We first develop the sprites we want to use by calling led_matrix.LEDSprite()
on
the already created .spr
files in the same folder. (This is similar to how we did
it in easy, but more efficent by using a for
loop.)
To animate the sprites, we quickly flash through different sprites together in succession just like
in easy. However, before we draw the sprite, we first need to
decide if the A button has been pressed by checking my_button.is_pressed()
with an if
statement, and then draw the sprite 2 pixels
higher (to simulate a jump) if the button is pressed.
.25
seconds on the line time.sleep(.25)