if player.hitbox[1] < platform_img.hitbox[1] + platform_img.hitbox[3] and player.hitbox[1] + player.hitbox[3] > platform_img.hitbox[1]:
if player.hitbox[0] + player.hitbox[2] > platform_img.hitbox[0] and player.hitbox[0] < platform_img.hitbox[0] + platform_img.hitbox[2]:
player.collision()
Here is my code for the collision detection between the player and platform using hitboxes. Currently the character can jump onto the platform but when they come back down they go below the screen. If I jump under the platform then the character's head gets stuck in the platform and they don't move down. How do I fix this?