When the user hits q to fire a bullet, there is no smooth motion. They need to move the mouse around the screen in order for the bullet to travel. I’ve tried looking around StackOverflow, youtube, reorganizing the code. I want the user to hit q and the bullet should fire with a parabola shape smoothly. Answer You’ve to do
Tag: pygame
How to put random numbers in Pygame
I expected the ball to move and every time it hits the corner change velocity. Answer To make the ball move, you’ve to use a variable for position wich can store floating point coordinates. The position is changed every frame depending on the speed. Finally the ball rectangle has to be updated with the position: Note, the coordinates of pygame.Rect
How to rotate an image around its center while its scale is getting larger(in Pygame)
I loaded an image and I want it to rotate around its center, while its scale is getting larger. I know how to rotate an image around its center originally, but it’s hard for me to calculate the position if the scale is getting larger. I tried it, but the image just ‘dances’, not staying in the center. Answer Short
Pygame, Collision between 2 objects in the same group
So, i am trying to create a game where aliens spawn from 3 specific places. Each Alien will spawn randomly in one of the 3. But there will always be at least one alien, that will spawn on top of another one. I want to delete that alien and spawn him randomly in another spawn point. If it is empty
How to rotate slices of a Rubik’s Cube in python PyOpenGL?
I’m attempting to create a Rubik’s Cube in Python, i have gotten as far as visually representing the cube. Struggling a bit with how to implement rotation. I guess i’m asking for feedback as to how to go about doing this. I thought at first of, rotating each cubes set of vertices’s, without much luck. I basically want to select
How to wrap text in pygame using pygame.font.Font()?
I am making a would you rather game, and I would like to not have character restrictions for the W.Y.R. questions. I have seen many examples here on Stack Overflow and other websites, but they use other modules and methods I don’t understand how to use or want to use. So I would rather use I would like to know
Drawing Semi-Circles in Pygame
Is there a way to draw a semicircle in Pygame? Something like this: pygame.surface.set_clip() will not work for this – I need circles that look like pie slices as well, like this one: Answer PyGame has no function to create filled arc/pie but you can use PIL/pillow to generate bitmap with pieslice and convert to PyGame image to display it.
Python pygame error using font: no such file or directory
i have a python pygame program that simulates a racecar, driving and dodging blocks, this program worked 100% until i tried it today, now it gives me a error, the error is: this makes me think somethings wrong with the font i use, it is realy very frustrating, and i realy cant see anything wrong, here is my code: the
pygame – How do I change a variable while it is being used?
I’m making a simple top-down game with moving and collision between player and walls, using pygame. I made my code so that when keys[pygame.K_LSHIFT] is True during the pygame.key.get_pressed at the state of the keyboard when it’s called, block_speed changes to 5 instead of 3. So it works and when I hold SHIFT and move with WASD keys at the
Pygame Line of Sight from Fixed Position
I am currently working on a 2D game in which the player has to sneak up on a still person within a certain amount of time. There are various crates in the way (depending on which level it is), and I would like to make it so that the player can hide behind crates to sneak up on the still