I am writing a pygame program that has a moving background which is a sprite. I was wondering if/how you can make sprites appear on top of others (some kind of priority in what appears on top of what). I know the order they appear on top of one another is based on which one is added to the screen first but I am wondering if I can change this.

Thanks

the first sprite you create will be put on the base.
any sprites put on after this will go on top

screen.blit(background, (300, 300))
screen.blit(smilie, (450, 300)) #This sprite will be on top as i blitted it last
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.