You need to check the pixel twice. First at:
Code:
y = my_player.pos_y + bmap_height(player_tga);



Then at:
Code:
y = my_player.pos_y;