So one thing that was kind of left on the table was fixing the axe passing through the bottom of the screen (because the axe’s y position is it’s top left corner).
I tried changing the code for moving the axe to:
//move the axe
axe_pos_y += axe_direction;
if (bottom_axe_y > canvas_height || axe_pos_y < 0)
{
axe_direction = -axe_direction;
}
where the bottom_axe_y variable is axe_pos_y + axe_length (defined at the beginning of the program)
but then the axe seems to get stuck at the bottom.
But if I do it like this it does work:
//move the axe
axe_pos_y += axe_direction;
if ((axe_pos_y+axe_length) > canvas_height || axe_pos_y < 0)
{
axe_direction = -axe_direction;
}
…and I don’t understand why the first one doesn’t work.