pygame-surface

trouble with pygame's colliderect

trouble with pygame's colliderect Question: trying to use pygames collide rect method to detect collision for the x axis of the player. the collisions are not registering at all… which is my problem im trying to mave a square to the right when i hold down the d button, and when i reach the platform, …

Total answers: 1

How to blit image in multilayer pygame without blending

How to blit image in multilayer pygame without blending Question: I’m trying to create a chessgame using pygame. I got a screen with two layers blitted on it. One being the chessboard and the other one with the figures. In order to update the screen, I’m blitting the layers onto the Screen. First the chessboard, …

Total answers: 1

How to load colorful emojis in pygame?

How to load colorful emojis in pygame? Question: I want to use Pygame’s freetype module to load a colorful emoji via its unicode. Unfortunately I only get a monochrome image with the outline of the emoji: Minimal, Reproducible Example: import pygame import pygame.freetype pygame.init() window = pygame.display.set_mode((200, 200)) seguisy80 = pygame.freetype.SysFont("segoeuisymbol", 100) emoji, rect = …

Total answers: 2

How to move an image when clicked on it in PYGAME?

How to move an image when clicked on it in PYGAME? Question: Basically, when I click on an image I want the image to move to a new different location. When I click again, it should move again. import pygame import random pygame.init() screen = pygame.display.set_mode((1420, 750)) pygame.display.set_caption("Soccer Game") icon = pygame.image.load(‘soccer-ball-variant.png’) pygame.display.set_icon(icon) ball = …

Total answers: 1

How i can remove the black background on my sprite sheet in pygame

How i can remove the black background on my sprite sheet in pygame Question: I’m trying to learn how use sprite sheets on pygame , and on my first try my sprite for some reason have a black background , i don’t know how i can fix this problem , i alredy put 000 on …

Total answers: 2

How to draw a chessboard with Pygame and move the pieces on the board?

How to draw a chessboard with Pygame and move the pieces on the board? Question: I’ve been trying different ways how to get my chess pieces to drag and drop I’ve found ways, but the problem is that I’m using a dictionary to load my images via pygame.image.load. I’ve created a dictionary for my images …

Total answers: 1

Pygame image transparency confusion

Pygame image transparency confusion Question: I have read the top 20 posts relating to this issue here, read many examples on Google, tried using .convert(), .convert_alpha(), tried with neither, tried with .png, .gif, tried with the top 5 different images on google. Please someone help me figure out how to make the pieces show with …

Total answers: 1

How do I convert an OpenCV image (BGR and BGRA) to a pygame.Surface object

How do I convert an OpenCV image (BGR and BGRA) to a pygame.Surface object Question: I created images from OpenCV/opencv-python (numpy.array) and I want to convert them to a pygame.Surface object: def cvImageToSurface(cv2Image): pygameSurface = # ? create from "cvImage" return pygameSurface surface = cvImageToSurface(cv2Image) Some of the images have 3 channels (BGR) and some …

Total answers: 1

How do I use blit() in the proper way in pygame?

How do I use blit() in the proper way in pygame? Question: I was trying to make a texture game, but it doesn’t work with no errors. I’ll show the code. import time import pygame from pygame.locals import * def Main(): pygame.mixer.init() pygame.mixer.music.load(r”C:…OMFG+-+Ice+Cream.mp3″) pygame.mixer.music.play(-1) pygame.init() screen = pygame.display.set_mode((640, 480)) screen.fill((0,0,0)) pygame.display.set_caption(“3 Minutes Left!!!”) font = …

Total answers: 2