Skip to content
Advertisement

Tag: pygame

User needs to move mouse to fire bullet

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

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

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 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

Advertisement