pygame

How to update text in PyGame?

How to update text in PyGame? Question: I wanted to make a game, where player can move to any arrow and get a point for so. I can render the text, but cannot update it. My code: import pygame, sys from pygame.locals import * import random import time pygame.init() FPS = 60 FramePerSec = pygame.time.Clock() …

Total answers: 1

Get smooth diagonal movement in Pygame

Get smooth diagonal movement in Pygame Question: I’m working on this decal creator using pygame. You basically have a bunch of sliders which controls the angle, radius, offset, etc. The sliders are incrementing in integers. As I’m increasing the offset from the center you can notice the dots are not following a perfect straight path. …

Total answers: 2

Prevent a player from moving faster than usual by moving in two directions

Prevent a player from moving faster than usual by moving in two directions Question: I’m messing a bit with pygame, a player can freely move around the screen with WASD and change the direction they are facing with ← and →, the problem is that they can move faster than usual if they hold two …

Total answers: 1

error, center argument must be a pair of numbers. newbie

error, center argument must be a pair of numbers. newbie Question: Just trying to draw a circle within a window as a player class, but having some trouble. Can’t get past this error, looked up other posts on the issue but to no avail. Understood that error stems from the need for x,y to be …

Total answers: 2

Remove border from opencv generated ellipse in pygame

Remove border from opencv generated ellipse in pygame Question: I’ve set up this window where I blit an ellipse to the screen. I would like to have the ellipse fully white with a smooth border. It looks acceptable, but when I add the ellipse to a white background, the border of the ellipse shows up. …

Total answers: 2

Python while loop bugs out

Python while loop bugs out Question: I’m trying to make a game with pygame in which an object moves and i’m trying to get rid of its previous image by drawing a background colored object in its previous position, but for some reason it just wont work, and i’ve extracted the part of the code …

Total answers: 1

A problem with not seeable cube in pygame

A problem with not seeable cube in pygame Question: I can not see a cube made from rhombuses. I opened this script after a few months and It is not working. I do not remember that in the past after the last chance, my code id had worked or not. it is a complex script. …

Total answers: 2

I am not getting an option to close the window in pygame

I am not getting an option to close the window in pygame Question: So, this is a simple code written to make the window and the background image. I need help with 2 things. 1. I am not getting the option to close, minimize or maximize the window, the entire thing is covered with my …

Total answers: 2

Why does the moon spiral towards Earth in simulation?

Why does the moon spiral towards Earth in simulation? Question: I am trying to simulate a somewhat realistic program where Earth and the moon can interact gravitationally with each other. Now the problem is that the moon keeps on spiraling towards Earth and I don’t understand why. This is my code: from math import sin,cos,sqrt,atan2,pi …

Total answers: 1

How do I "Push" an object (crate) with another object (player) in Pygame?

How do I "Push" an object (crate) with another object (player) in Pygame? Question: I’m trying to make a pushable crate using Pygame. I’m able to push the crate in all directions (up, down, left and right) which works fine. I can also push the crate up or down and move left and right at …

Total answers: 1