How to make random spawnpoints in pygame that change color each time [duplicate]
This question already has answers here: How to make sprites spawn at random? (2 answers) How do I get the snake to grow and chain the movement of the snake’s body? (1 answer) Closed 8 mins ago. I am currently trying to make rectangles spawn randomly around in an area where you can still be […]
How do I get the snake to grow and chain the movement of the snake’s body?
I want to implement a snake game. The snake meanders through the playground. Every time when the snake eats some food, the length of the snake increase by one element.
The elements of the snakes body follow its head like a chain.
Why doesn’t Marching Square Visualization In Pygame draws nothing?
so i wanted to draw implicit equation of heart in pygame via using the marching squares algorithm in it. i implemented the marching square’s algorithm but it doesn’t work? can anyone help me out why?
How can I fix my pygame collision not working correctly?
Ive been going crazy trying to figure out how to get the collision right on pygame. Whenever the player falls onto and collides with a platform, it runs correctly and puts the player onto the platform. But if the player falls off the platform and its side hits the side off the platform, it puts the player back on top of the platform.
Sprite not centering in pygame when being scaled up
I’m trying to make a game where a laser is being fired and you have to dodge it, but when i resize the laser to make it taller, the image moves downwards. I think this is because the sprite isn’t properly centered. How do i center it? Sorry if I’m asking a stupid question.
Flickering images – Pygame rects
I’m trying to create a scrolling star background. It runs fine and creates all of the stars, but when one is removed, every star on the screen flickers.
Variable outside function being modified without a “return”
My apologies if this is really obvious but I honestly have no clue what’s happening.
I call a function with a list entry as one of the parameters. Inside the function, I modify the values because I need to, and somehow the original list ends up being changed even though never referenced?
correcting my computer car’s path following in pygame
So, i tried making a race game with a computer car and a player car. I have appended the points to a path variable and coded the necessary functions and everything. the code doesn’t seem to work as well. at the beginning the computer car seems to tilt before it starts moving which seems to mess up the angle calculation so the car doesn’t follow the point exactly. when i reduced the velocity and rotational velocity of the computer car it follows the path. not quite well but at least it doesn’t completely veer off the designated race track. i still want to fix the tilt at the beginning.
Removing the border around an object in pygame
How do I remove the blue border around the ship so that the background, which is loaded as a .bmp image, can be seen?
I added the convert_alpha and set_colorkey functions but it didn’t help. I don’t know if I need to add another function or do something in the alien_invasion.py file
Stars Misaligned in Pygame Grid – First Star in Each Row Appears Differently Positioned
enter image description here
The stars in the first column of each row appear to be misaligned or have a different background color compared to the rest of the stars in the grid.
The issue seems specific to the first star in each row, as the rest of the stars align correctly.
here is the relevant code,