Pygame clock and event loops
i am new to pygame and i was wondering what an event loop is and what clock does in this situation, like what is clock.tick(60)? I don’t understand any explanations online
i am new to pygame and i was wondering what an event loop is and what clock does in this situation, like what is clock.tick(60)? I don’t understand any explanations online
I have been watching Pygame tutorials to learn the module, and it came to the portion where the instructor shows you how to make your character jump. However, I am finding it impossible to understand the code they put down, and they did not explain it very well.
Before you criticize me for not Googling or doing research before asking, I did research beforehand but to no avail.
I am making small game with pygame and I have made a gun that rotates around its center.
My problem is that I want the gun to rotate by itself to the enemy direction, but I couldn’t do that because I can’t find the angle between the gun and the enemy to make the gun rotate to it
I have searched and I found that I have to use the atan2 but I didn’t find any working code so I hope someone could help me.
I tried using this kind of code: if circleX – 16 == 0: circleX = 16 elif circleY – 16 == 0: circleY = 16 elif circleY + 16 == 500: circleY = 484 elif circleX + 16 == 500: circleX = 484 elif circleY – 16 == 0 and circleX – 16 == 0: … Read more
This is my player class
I am trying to create a game using pygame and I am attempting to add a background to it (I have used some code from a YouTube video but this is not working). I also to not understand what the code is on about. I mean the background and does move but it automatically adds a new version of the background in the middle of the screen when the older background has not gone off screen yet:
The objective was to make some bullets come out of the current position of the player and then have them move in a straight line, defined by a vector that is defined by the points of the mouse position at the time of clicking the button and the position of the player, but when the button is pressed nothing happens. Can anyone tell me whats wrong with this code? Thank you
How can I draw a rectangle that has a color with an alpha?
I have:
I have some code: