Blinka jumps every time the A button is pressed on the PyBadge board. To do this, when a button press is detected from the A button, the snake
state is set to False
. You'll remember that whenever the snake
state is True
, then the Blinka sprite is in the default slithering animation.
if current_buttons != buttons: if buttons & BUTTON_A: snake = False
Once snake
is False
, then the Blinka sprite's y
coordinate is updated to be 16
, or one row up, and the tilegrid's sprites are updated to be JUMP_1
and JUMP_2
.
else: # Blinka JUMPS # y location changes one row up and both jump sprites are shown blinka_grid.y = 16 blinka_grid[0] = JUMP_1 blinka_grid[1] = JUMP_2