pygame

Why is there an incorrect display of objects in the Pygame?

Why is there an incorrect display of objects in the Pygame? Question: I’m creating a game on Pygame and faced with the problem that the objects are displayed incorrectly I want the objects in a row but I wrote it diagonally My game: import pygame, controls from gun import Gun from pygame.sprite import Group def …

Total answers: 1

topleft from surface rect dont accept new tuple value

topleft from surface rect dont accept new tuple value Question: I create pygame screen. import pygame pygame.init() screen = pygame.display.set_mode((330, 330)) Then i create an object of my own class and give him a tuple. mc = MyClass((10, 10)) This class has a problem. topleft from surface don`t accept new tuple value. class MyClass: def …

Total answers: 1

line collision detector with circles

line collision detector with circles Question: not long ago I am in python and I decided to make a path planning program, the truth cost me a lot since I am a beginner, but good to the point, is to generate circles of random size and position that do not collide with each other and …

Total answers: 1

Circle collision, pop-up error "CreaCir' object has no attribute 'radio'"

Circle collision, pop-up error "CreaCir' object has no attribute 'radio'" Question: I make a program where I generate circles of random size and position, by means of classes in python, I have managed to generate the circles as I wish but all collide with each other, so I have created a method so that this …

Total answers: 1

Sprite not being drawn

Sprite not being drawn Question: I am a beginner programmer practicing with Python. I am trying to make a simple game, what I have so far is just adding the character sprite onto the map. What I’m trying to do is when no keys are being pressed, that the character sprite continuously switches between two …

Total answers: 1

Sprite shadow changing to full black

Sprite shadow changing to full black Question: player.png shadow comparison The shadows are different when I blit the player image to a surface and then loading that surface to the display vs loading the entire image on the display import pygame pygame.init() display = pygame.display.set_mode((1280, 736)) display.fill(‘#555358’) clock = pygame.time.Clock() if __name__ == ‘__main__’: image_1 …

Total answers: 1

TypeError: descriptor 'collidelist' for 'pygame.Rect' objects doesn't apply to a 'list' object

TypeError: descriptor 'collidelist' for 'pygame.Rect' objects doesn't apply to a 'list' object Question: Trying to set up a system to earn score points by killing enemies. but i keep getting: TypeError: descriptor ‘collidelist’ for ‘pygame.Rect’ objects doesn’t apply to a ‘list’ object. But it worked one line before. This is the first program that ive …

Total answers: 1

I have a problem with my "Game of life" on python

I have a problem with my "Game of life" on python Question: I don’t know why but my "def" that checks 3 rules of "Game of live" doesn’t work correctly. I have 2 lists that contains 0 and some 1 to check the program. 3 points that should give this image but instead it gives …

Total answers: 1

sprite.rect.colliderect AttributeError'

sprite.rect.colliderect AttributeError' Question: In hits = pygame.sprite.spritecollide(fallschirme,bullets,False) i get the message sprite.rect.colliderect AttributErros and ‘Group’ object has no attribute ‘rect’. The relevant code is listed below. i looked similar question but i didn’t find something simular. class Fallschirm(pygame.sprite.Sprite): def __init__(self,x,y): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("Bilder/fallschirm.png").convert_alpha() self.image = pygame.transform.scale(self.image,(100,150)) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = …

Total answers: 1

Error while using multiprocessing in Pygame

Error while using multiprocessing in Pygame Question: i’m making a text-based RPG and am trying to use multiproccessing to run both the pygame check function and the game function at the same time. This is my first time using multiprocessing so i’m not entirely sure what is going on. Here is the (important) code: from …

Total answers: 1