Most voted "pygame" questions
81 questions
Sort by count of
-
0
votes1
answer40
viewsHow can I do that without needing this global variable?
The problem I have is the following I have a method that should be called 4 times, once every 750 ms. The problem is that the way it is called I can’t pass arguments to it, why it is called via…
-
0
votes1
answer85
viewsFind the last matrix position
I’m making a game in pygame and need to know the last position of the matrix for the movement of enemies. It has to be according to the size of the matrix, that is, the last column and the first…
-
0
votes1
answer363
viewsError initializing PYGAME
I’m creating a simple replica of the game Space Invaders in Python3.7, at first I was creating the screen all with Turtle, but the game entered in a kind of infinite loop and did not execute the…
-
0
votes1
answer1125
viewsHow to put a text on the pygame screen?
I was trying to put a text inside a pygame screen in a specific coordinate, what can I do to print a text and restrict its area? import sys, pygame pygame.init() size = width, height = 800, 600…
pygameasked 5 years, 2 months ago Hugo Amorim 1 -
0
votes1
answer356
viewsObject movement
I would be creating a game for a college job, but I’m having some difficulties, among them, one in which I can’t get the character to move up or down, just sideways, accusing me of this mistake:…
-
0
votes1
answer99
viewsI’m creating flap by the pygame and the animation is not working well
So following as I said in the title I am creates a flap Bird , I have not yet implemented physics and the tubes however my problem is being with his animation , What’s happening is that it only…
-
0
votes1
answer305
viewspygame installation error in vs code
When installing pygame no vs code by the console and it returned me the following: pip install pygame Defaulting to user installation because normal site-packages is not writeable Collecting pygame…
-
0
votes1
answer1991
viewstypeError: 'module' Object is not callable
I’m trying to add layers to my game window, so I tried using Sprite groups, but there’s this mistake that I don’t understand why it persists: TypeError: 'module' object is not callable I searched…
-
0
votes0
answers134
viewsIs there a better way to implement collision in the pygame?
I’m making a game, like Arkanoid. The physics of collision between objects and the screen are great. The "colliderect(rect)" method works, but when the ball hits the batter’s sides, the ball instead…
-
0
votes0
answers37
viewsHow to make a Function in Pygame show a texture?
We want to make a kind of Menu that contains a tutorial of the game that will appear on the top of the stage at the beginning and when the player presses the help button, but we cannot make this…
-
0
votes0
answers17
viewsAbout Pygame, I need a picture to get smaller and soon dps return to their normal size, cm a button being pressed for example
My main problem is that when I create a function to get the image back to normal size, instead of it shrinking back to normal, it simply skips the step of shrinking the image. (it does not have the…
-
0
votes1
answer102
viewsEvent.key does not work
So I’m trying to make the screen stay fullscreen in the pygame, only event.key doesn’t work. Follow the error: Traceback (most recent call last): File "C:/Users/Ailtinho/Desktop/Scirpts-Python/Jogo…
-
0
votes0
answers36
viewsBug while running program in Pygame
I have a problem creating the game menu. What happens is that when I create the function draw_text, the program is on black screen and I notice that it shows nothing on the screen causing it not to…
-
0
votes0
answers23
viewsI need help with pygame
Hello, I’m creating a clone of the famous game Frogger, but I’m in trouble at a point I need to change the image of the enemy(car) when it comes in reverse, follow my code here import pygame import…
-
0
votes0
answers28
viewsMouse placement in the center of a rectangle with pygame.mouse.get_pos()
Hello! I read the following code with Pygame: import pygame PRETO = (0,0,0) AMARELO = (255,255,0) VERMELHO = (255,0,0) VERDE = (0,255,0) AZUL = (0,0,255) BRANCO = (255,255,255) LARGURAJANELA = 500…
-
0
votes1
answer28
viewsHow to treat a function value as an existing variable?
I’m making a simple game, just to test the Pygame library. It turns out that as in the game I would have several objects I found it more feasible to create a function to move them: def…
-
0
votes1
answer42
viewsDraw things in pygame
I’m reading a python book had a code I can’t understand: my doubt Doubts: 1.What is this get_rect() ? 2.How does it work to treat things like rectangle ? 3.What is self.screen_rect =…
-
0
votes0
answers14
viewsHow to make an Sprite turn red and return to the original color?
I am recreating a game in pygame as a hobby, in this game I have a ship that can take a single shot or keep shooting if you hold the button, but the ship will heat up and gain a red coloring. But…
-
0
votes0
answers23
viewspygame error using key.get_pressed()
I was testing the pygame, and I came across a mistake. I made a red square appear on the screen, and I made the code for it to move too, set the WASD for locomotion, but when I ran the code, and…
-
-1
votes0
answers267
viewscmd -> Pip -> "The system cannot run the specified program."
People how to solve this? windows 10-64bits and Python 3.6.5 (64-bit)…
-
-1
votes1
answer729
viewsPygame - How to solve the image’s phantom effect
I am doing some tests in pygame and created a "character" that moves, but it creates a ghost effect on the screen. I’d like to know how to solve. (This land is what the character would be) The…
-
-1
votes1
answer52
viewscopy text from pygame
Guys, I’ve tried everything and I can’t copy a text from a Pygame window. The code is as follows: import pygame screen = pygame.display.set_mode((800, 600)) pygame.font.init() font1 =…
-
-1
votes1
answer69
viewsFile execution error in pycharm
Good morning, everyone, I’m experiencing a boring situation that I’m having trouble solving. When running the game I’m developing the following image appears: Everything was fine before, the program…
-
-1
votes0
answers57
viewsWhat is the shortcut to the "C" key in Pygame?
You can use this key with the Event.key method? What is the key call? I am developing a simple and accurate Synth of sounds of as many input keys as possible. import pygame if event.key == K_v:…
-
-1
votes1
answer90
viewsPygame is not drawing an object
I’m making a game in python using pygame. The game consists of a player who shoots small bullets depending on the position of the mouse and itself. Everything runs smoothly, the player moves as I…
-
-1
votes2
answers274
viewsHow to resolve character overlays (sprites) on screen with Pygame
I am developing a TOP-DOWN game with several enemies, however, due to the order in which they are plotted on the screen, no matter if one is behind the other, always the one that was plotted last…
-
-1
votes1
answer580
viewsPlaying mp3 music in Python
all right? Well I come here to ask for a solution regarding playing mp3 music in Python. I imported the Pygame library and used the mixer module to play python music: import pygame pygame.init()…
-
-2
votes1
answer26
viewsHow can I upload files so they work on other Pcs even if the path to the file is different? (Pygame)
Oops! So... I’m doing a program using the pygame, and when it comes time to upload a file, I should use this, right? bulletImg =…
-
-2
votes1
answer351
viewsI’m having trouble making the character move in python with pygame
import pygame pygame.init() tela = pygame.display.set_mode((800,600),0,32) personagem = pygame.image.load('./você.png').convert_alpha() def…
-
-2
votes1
answer379
viewsError trying to install packages on Linux using Pip command [Linux]
I cannot install packages using Pip on linux, this is the error screen: Collecting pygame Using cached pygame-1.9.6.tar.gz (3.2 MB) ERROR: Command errored out with exit status 1: command:…
-
-4
votes1
answer51
viewsI can’t figure out what’s causing this mistake
I’m doing a python project of game four online and have the value function that tells me what value is placed at a certain point of the table. grelha = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0],…