The actual height of the flappy image is 45 pixels:
$ file assets/flappy_dragon.png assets/flappy_sprite_sheet.png
assets/flappy_dragon.png: PNG image data, 65 x 45, 8-bit/color RGBA, non-interlaced
assets/flappy_sprite_sheet.png: PNG image data, 249 x 45, 8-bit/color RGBA, non-interlaced
However, the height is listed as 65 for both the asset loading and collision detection for the entirety of the book. Here’s the asset loading code starting in chapter 7 (FlappyAnimation
directory):
.add_sprite_sheet("flappy", "flappy_sprite_sheet.png",
62.0, 65.0, 4, 1)?
And here’s the collision detection code starting in chapter 8 (FlappyCollision
):
spawn_animated_sprite!(
assets, commands, "flappy", -490.0, 0.0, 10.0, "Straight and Level",
Flappy { gravity: 0.0 }, FlappyElement, Velocity::default(), ApplyGravity,
AxisAlignedBoundingBox::new(62.0, 65.0)
);
I noticed this because you can make Flappy crash without touching the wall if you try to nose dive right after clearing the wall.