Skip to content
Advertisement

Pygame : player sprite that disappears behind the background

So there you go, I wanted to experiment a little pygame but I find myself stuck.

Context

I created a small sprite (with Piskelapp) that represents the player and looks like:

player.png

player.png

then add my background in jpg format. However when launching the game, my sprite is cut by the background as follows:

bg and player.png

The ship is not placed in front of the background and more I go up it, more it disappears behind the background…

Here is my code:

JavaScript

anyone have a tip? I’m wondering if it’s not a file format problem? thank you for your time

Advertisement

Answer

In you game mainloop, you should put:

JavaScript

before:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement