I've been struggling to find a solution in Python using Pygame that allows me to detect scrolling up. My goal is to recreate the experience from the popular video "Interstellar Mouse" https://www.youtube.com/watch?v=aANF2OOVX40 I want to trigger the ...
My attempt to play sound using Python through pygame is resulting in a strange issue. When I run the program, all I hear is a popping noise and then it abruptly quits. The audio track I am trying to play is at least 20 seconds long, but for some reason the ...
Currently, I am working on a game where a dog chases a ball and the ball chases the mouse cursor. The goal is for the game to stop and display "Game over" once the dog reaches the same position as the ball. However, my code currently checks if the two obje ...
I am currently working on a Pygame project to develop a jumping system, but I'm encountering challenges with collision detection. My level is stored in a list structured like this: level = [ "WWWWWWWWWWWWWWWWWWWW", "W W", "W ...
Apologies for my lack of experience with Python, but I have a question that involves two files - File1 and File2 In File1, I have defined the variable X. This file modifies the value of X throughout my game and also imports specific objects from File2 Wi ...
As a beginner in Python, I am currently working on creating a snake game. However, I keep encountering an error stating that the 'rect' argument is invalid. File "c:UsersIdontwanttomentionDesktopCodingPygameSnake.py", line 47, in <modul ...
After following a tutorial on YouTube by TechWithTim, I successfully completed a solar system project in pygame. With plans to expand it further, adding more planets caused the program to crash due to memory issues related to orbit rendering. How can I eff ...
myfile = open('kill.txt', encoding='utf-8').readlines() NoiseMP3 = myfile[3] bop = pygame.mixer.music.load(NoiseMP3) pygame.mixer.music.play(-1) Essentially, the file name is specified on line 3. When I change NoiseMP3 to the actual file name, the file i ...
I am currently working on a project with two moving sprites. One sprite is named wall and it moves up and down, while the other sprite is called Player and it bounces around the screen, changing direction whenever it hits an obstacle. I have managed to ge ...
Currently, I am developing an algorithm that examines the outline of a continent based on a simple black and white map. The goal is to return the perimeter of the shape. For instance, consider the following example: [(1,0), (2,0), (2,1), (2,2), (3,2)...] ...
Currently, I'm working on creating a basic game using pygame, but I've encountered an issue that I need assistance with. Let's say we have two sprites, named sprite1 and sprite2, each with their own rect and image. These sprites are interac ...
I'm currently developing a game that requires the ability to display GUI elements within a pygame surface. I have researched various options but have not found exactly what I need. Some libraries like Ocemp, PGU, and GooeyPy seem to be in this problem ...
I recently developed a Python game using Pygame which operates flawlessly in both Portrait and Landscape orientations. However, I encountered an issue when the user rotates their device while the game is running, causing everything to appear jumbled up on ...
Having some trouble while attempting to set up pygame_sdl2 on my system. Each time I run the command: python setup.py install I encounter this error message: sh:1:sdl2-config not found Apart from that, I am also getting an error like this: subprocess.Cal ...
Here is a sample code snippet: from tkinter import * import numpy as np rows = 10 columns = 10 width, height = rows*18, columns*18 window = Tk() window.geometry(str(width)+"x"+str(height)) window.resizable(width=False, height=False) window.confi ...
Currently facing an issue with setting up different block packs for drawing maps on the platformer game. Theoretically, pressing specific numbers should do the trick. All files are organized in a folder with the correct hierarchy. What would be the optima ...
As per the pygame documentation, calling pygame.mixer.Sound().play() is expected to return a Channel object, and indeed it does. However, on certain occasions, it appears to return None causing an error to occur immediately after: NoneType has no attribut ...
Looking to add a logo slideshow before launching your game? I have an idea. You can display logo 1 for 2 seconds, then logo 2 for another 2 seconds before the game starts. How can you achieve this? I attempted to implement this feature within the main loo ...
After attempting to execute the sample code "python3 -m pygame.examples.aliens," I encountered a syntax error (as shown below). Initially, I suspected that there might have been an issue with my pygame installation. However, upon further investigation, I n ...
Currently, I am in the process of creating a boid program using Python. This project involves two separate programs - "boid.py" which defines the boid class and "flocking practice.py" which is intended to utilize this class and display the boids on the scr ...
After several attempts, I am still struggling to keep my enemy stationary while moving the camera with my player. Unfortunately, when the screen shifts, my enemy slowly drifts away from its original position. Additionally, if my player collides with a plat ...
Currently working on a python memory game, I am struggling with determining the number of boxes that the user clicks based on the cursor's position. This is what I have so far: number = ev.pos[y]//boxsize*numboxsx+ev.pos[x]//boxsize (this calculation pr ...
For my chess project, I am developing a Chess clock that follows specific time formats commonly used in the game. In one format, players are granted 5 minutes each initially, and whenever a move is made, 5 seconds are added to the clock. Another example is ...
Currently, I am working on developing a game using the pygame module. However, I have encountered an issue with the fullscreen mode functionality not working as expected. Although the program itself runs smoothly, when attempting to switch to fullscreen mo ...
https://i.stack.imgur.com/GhtFy.jpg Looking to divide the screen into two separate areas like shown in the image using pygame - one for gameplay and the other for player input. Any tips on how I can achieve this? ...
Instead of using numpy. If I have information about the size of my elements and grid, can I determine the coordinates of the top left corner of my grid? Rect size: 62x50 WxH (g_height, g_width) Grid dimensions: 12x12 """self.row/column changes with mou ...
After extensive searching for a solution, I have not been able to find one. Here is the code I am working with: class snakeGame: def _init_(self): pygame.init() self._isRunning = False self._surface = None self.drawList ...
Setting up Pygame on my MAC has been a challenge for me. My specifications include OS X El Capitan 10.11.4. Whenever I try to run a file with import pygame, I encounter the following error in terminal: ImportError: No module named 'pygame' Following the ...
I have recently started learning Python programming and am working on developing a game for my class project. However, whenever I run the program, the screen becomes unresponsive before allowing the user to input anything. Can anyone help me figure out wha ...
Are you interested in creating a user interface that includes forms for app configuration and a rendering component, such as displaying sprites? Is there a way to integrate PySide with PyGame within a single application? For instance, how would one go abo ...
Running my code for the first time with spritesheets, I encountered 2 errors. The first error seems to be related to passing 4 arguments instead of the expected 3 when calling for the spritesheet. Even though I only see 3 arguments being passed. The seco ...
Currently, I am working on a game project involving gathering trees and battling zombies. One issue I am encountering is that the hitboxes of trees are not staying in place while walking on the map; instead, they move along with the screen. I have b ...
Creating a game with enemy ships that shoot lasers at the player sprite presents some challenges. These enemies need to rotate in order to face the player and then fire a projectile aimed at colliding with the player ship. The current issue is that the la ...
I am currently working on a Python program to generate and display the Mandelbrot set. However, I am facing an issue where the rendering is only showing a black image pixel by pixel. My setup includes Python 3.7 and pygame version 1.9.4. The problem seems ...
I am in the process of recreating an old 2d space shooter game, and have successfully completed most of it. However, I have encountered a roadblock when trying to implement the shooting mechanism. I am also wondering if I should utilize Pythagoras' t ...
Working on my final project, I created a code for a bouncing ball effect. Initially, I intended to have two balls in action so I designed a class and incorporated multiple functions. However, after implementation, it seems that my code is not functioning ...
I'm new to my first python project and just learned how to set true/false variables for buttons on different pages. However, I'm struggling with getting a specific button to go to a function. In my game, the player makes choices that lead to different di ...
My friends and I are collaborating on a fun game project using Python and Pygame. Today, while working on the weapon part of the code, I encountered an issue where the incorrect weapon images were loading (it was actually loading character images from a d ...
I'm a beginner in pygame and I'm looking to gain some basic knowledge. My goal is to create obstacles and determine which side of the player rectangle (representing the collision box of the sprite) is colliding with the obstacle rectangle. This w ...
I've been diving into the world of pygame and encountering some frustrating errors. Every time I try to add a background image to my window, I keep receiving an error message saying No file found, even though the image name is correct. For reference ...
One of the challenges in my game is implementing falling objects that appear at random positions on the screen. However, I keep encountering an error message that says: "empty range for randrange() (0,-799, -799)". It seems like the object must have a ne ...
I'm having an issue with my score not updating correctly. Whenever a player scores, the debugger shows 0's. Here are the variables for tracking the scores. player_score = 0 opponent_score = 0 basic_font = pygame.font.Font('freesansbold.ttf', 32) And here ...
I've been attempting to rotate an image around its center using pygame.transform.rotate() but for some reason it's not working as expected. The specific line of code causing issues is rot_image = rot_image.subsurface(rot_rect).copy(). This results in the f ...