pygame

TypeError: invalid rect assignment with vectors

TypeError: invalid rect assignment with vectors Question: I am a novice to programming and wanted to make pong as one of my first projects. I am now trying to get the pong ball to bounce to a random location but i got a TypeError: invalid rect assignement. Here is my code: import pygame import os …

Total answers: 1

Player collision with tiles not working, instead falling through them

Player collision with tiles not working, instead falling through them Question: Basically I’m learning pygame. and I’m learning from a tutorial, I’m not doing 100% the same but mostly, now I can’t figure out why the tutorial works and mine doesn’t, in terms of colliding with tiles. Here’s my code: import sys import pygame clock …

Total answers: 1

Pygame get_rect() is not running

Pygame get_rect() is not running Question: get_rect() is not running I was trying to make a simple game for educational purposes using the pygame module. I encountered this error. I would be glad if you can help import pygame import random import sys import os pygame.init() balikci_konum = "E:/E/Python/Python-eski/Oyuncalismalari/balik_avlama_oyunu/textures/balikci.png" genislik = 1000 yukseklik = 600 …

Total answers: 1

how to display only a few sprites from a group at a time

how to display only a few sprites from a group at a time Question: i wanted to make a game start screen and wanted to show only a few buttons at a time from a group, but i did not want to create multiple groups for each screen as i think its not optimal. i …

Total answers: 1

Pygame opening and closing immediately after running

Pygame opening and closing immediately after running Question: I’m writing a simple game of gomoku with pygame, but when I run the program the pygame windows opens and exits immediately after running. I know it’s something wrong with the program itself as I tested pygame with an online pygame program and it worked fine, but …

Total answers: 1

How Do I Move My Player Object In Pygame?

How Do I Move My Player Object In Pygame? Question: I am currently learning how to use classes for cleaner code. In a game I started to work on in Python has a player object, and I don’t know how to move the player. When I press any arrow key the player’s rect moves; however, …

Total answers: 1

Trying to make a spinning cube but only shows a small white dot spinning?

Trying to make a spinning cube but only shows a small white dot spinning? Question: I’m using pygame to make a 3D cube and make it spin but for some reason the output is just a small white dot. I think the cube is so small it looks like a dot. import pygame from pygame.locals …

Total answers: 1

can't blit a surface with its lines on display

can't blit a surface with its lines on display Question: I’m trying to draw a line on a surface that I then blit on the display. When I’m doing so, only the surface appeares while the line is not drawned. The code I wrote is import pygame as pg import numpy as np pg.init() # …

Total answers: 1