Questions tagged [pygame2]

The PyGame 2.0 version. PyGame 2.0 is backward-compatible along with Python 2 support.

The PyGame 2.0 version of PyGame. Released on October 28, 2020, PyGame 2.0 is backward-compatible along with Python 2 support.

References:

58 questions
0
votes
0 answers

In PyGame 2.2.0 on Windows, what does pygame.DOUBLEBUF do exactly?

I have an application that works rather well if OpenGL is initialized like this: pygame.display.set_mode((w, h), pygame.OPENGL|pygame.DOUBLEBUF, vsync = 0) While profiling it, I noticed that pygame.display.flip() takes 99% of the time. I concluded…
wiz21
  • 141
  • 7
0
votes
1 answer

Pygame display.update() refreshes the whole width of window instead of requested Rect only

I'm discovering Pygame and stuck on some problematic behavior that I can't figure out. I am trying to refresh a 80px square in the center of the window with the code below, but the whole line turns blue instead of the square only as expected. Is…
Aurélien
  • 64
  • 5
0
votes
0 answers

Camera with Border Collision

I am trying currently to program a functioning camera that follows the player, and stops whenever the player gets close enough to the border that the outside would appear. Most of everything works fine except for the collision with the right and…
Alv-Rod
  • 1
  • 2
0
votes
0 answers

I don't know how to combine SDL2 and pygame on android

I'm currently trying to create a game on my phone using the Pydroid IDE. I'm using Pygame and I would like to use the pygame._sdl2.touch function to detect multi touch on my phone. Learning from the official Pygame website, I apparently need to…
Grieljis
  • 1
  • 1
0
votes
0 answers

Can someone help me with a pygame sudoku game?

Recently I've been trying to make a project for college and I wanted to make a sudoku inside of a GUI with multiple games, but this one keeps giving me headaches. Apparently every time I insert the line tabuleiro_data, tabuleiro_preenchido =…
0
votes
0 answers

swept AABB collision, object sticking to right and bottom of obstacle when applying response

@dataclass class Collision: time: float = 1 normal: Vector2 = Vector2(0, 0) @staticmethod def not_occur() -> 'Collision': return Collision(1) def __bool__(self): return self.time < 1 @property def…
cherrrry9
  • 35
  • 1
  • 4
0
votes
0 answers

My pygame timer isn't stopping after it reaches the time limit

so I'm trying to make a game, but I've come into a problem. I'm trying to make it so that when Enter is pressed, the program will start printing "text" for 1 second. When I run the code, it gets the input and starts printing, but it won't stop. I…
notOli
  • 1
  • 2
0
votes
1 answer

transparent bits in pygame mask are black instead of being transparent

I have a program where it fills in the bits of a mask that are overlapped from another mask, but when I blit the mask of the overlapping bits onto the screen, the transparent bits are fully black for some reason? The program works as intended and…
expoodo
  • 65
  • 1
  • 8
0
votes
0 answers

No module named 'pygame' macOS issue

I am trying to install and use pygame on macOS through IDLE. I have used the pip install pygame command and the terminal says that pygame is installed on my computer. However, whenever I use "import pygame" I get an error that says: Traceback (most…
jkrue242
  • 1
  • 3
0
votes
1 answer

Pygame: Drag and Draw Rectangle on Mouse Click and Drag

I'm new to Pygame. I wanted to drag and draw the Rectangle when we click and drag left mouse button. The Left Click creates a small new rectangle where ever the cursor is present and Dragging increases rectangle size. Once done, Later, we can…
user15946403
0
votes
1 answer

Weird vector movement in pygame

For some reason the movement of my sprite is only diagonally up and left when pressing A, diagonally down and right when pressing D, and W/S just don't work despite the correct vectors being given to move in any direction. Here's where the inputs…
Cubli
  • 39
  • 5
0
votes
1 answer

Unpredictable enemy speed changes

I made a game where enemies chase a player while the player collects coins through the map. It worked properly when i ran it in the idle but when i run it as an application (using auto-py-to-exe) the enemy movement has randomly changed..now they are…
Danish
  • 103
  • 2
0
votes
2 answers

Screen not refreshing in pygame

So im new to python, and im working on a code. The code is supposed to make a spirograph move and im almost finished and at the last step, but when i ran it, the screen doesnt refresh even though im sure that the circles are moving by printing out…
Ven
  • 31
  • 5
0
votes
1 answer

I am getting TypeError: function missing required argument 'dest' (pos 2)

This is the code: import pygame, sys from pygame.locals import * pygame.init() DISPLAYSURF = pygame.display.setmode((400, 300)) pygame.display.set_caption('Hello World!') while True: # Main game loop for event in pygame.event_get(): if…
0
votes
2 answers

moving diagonally makes player go faster

I have this simple script for movement. if x > 0: if key[pygame.K_a] or key[pygame.K_LEFT]: rect_player.move_ip(-1 * speed, 0) if x < SCREEN_WIDTH - 110: if key[pygame.K_d] or key[pygame.K_RIGHT]: rect_player.move_ip(speed,…
Coder Gautam YT
  • 1,044
  • 7
  • 20