Skip to content
Advertisement

Tag: pygame

How to make sprite move to point along a curve in pygame

I’m doing a pygame project for practice and I need a sprite to move to some point on screen and I did it, but it moves in a straight line and I would like to learn how to make it move to the same point in a curve. This movement looks like and I would like it to be like

Pygame displays a black screen

I did some research to see if I could fix my problem on my own but it has been fruitless so far. I’ve checked to see if I ran the .display command too much but I haven’t, the program will run without error but the screen appears black except when I close the window out, you can catch a glimpse

Shorter way to make colliderect in if statement work?

I have two objects: And I want to make an if statement if they collide with a third object. This code actually works but is too long: And there’s an error when I try to write: So, what is wrong? Is there a shorter way to write it? Answer The first thing you can do is use shorter variable names,

I am having trouble with enemies in pygame

I have been trying to create an enemy class for my snake game that I can execute in my pygame loop, but my fill_screen() function keeps it so that either one enemy is on the screen at a time, or no enemies are on the screen. I hope someone can help me with this issue, because I have been working

Flip sprite when changing the direction of movement

Today I started to learn pygame and python to eventually remake the simple game “Graphwar”. As my first project I chose to make a really simple 2d car game while following a tutorial, now I want to try something on my own. That is to make my cars to visually change direction by using pygame.transform.flip() when pressing A or D.

Pygame delete non sprite objects

So Im trying to make an upward scrolling platformer, and I need a way to delete the score counter and hide the death screen when a player dies and restarts. However, those objects aren’t sprites. Is there still a way to delete them? Answer this is just an example because you have not provided any code :'( you have to

Advertisement