Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [pygame]

Pygame is a portable Python package for video games, built on SDL.

Filter by
Sorted by
Tagged with
7 votes
3 answers
992 views

Is this Python/Pygame that draws a maze well structured?

I'm not very confident about this piece of code I created, it basically takes a file like this: ## # ## ## # #B # # # ## ## ## A###### Then proceeds to ...
José Gomes's user avatar
12 votes
2 answers
1k views

Space shooter game using pygame

I have made a space shooter game in pygame with over 800 lines of code (including blank lines). The aim of the game is to kill all of the ships in the game. You start with a small spaceship and one ...
coder's user avatar
  • 121
6 votes
1 answer
138 views

Code for a basic dodging game in Python

Can someone review the code for this dodging game I made a while back? I want to see if there are any improvements or optimizations I can make as I am more or less a Python beginner. ...
Baba20's user avatar
  • 97
2 votes
1 answer
113 views

Pong using pygame module

I made a game in Python where you play Pong against an AI. As I am quite new to pygame, I would be grateful to hear any possible improvements. This is my code: ...
sbottingota's user avatar
2 votes
1 answer
86 views

Agent based Dengue transmission simulation

I'm trying to implement the dynamics of Dengue transmission between mosquitoes and humans. I decided create two classes, one for the human population and another for the mosquitoes. Both are based on ...
Athansya's user avatar
2 votes
2 answers
817 views

How can I get my CPU Utilization Down? PYGAME PROJECT

I get 25% CPU usage on this simple project. I hope it's okay if I just post the whole thing. It probably something to do with the rendering code. It's definitely the project though, my fans get loud, ...
DizzyDazzo12's user avatar
0 votes
0 answers
53 views

Snake game player movement pygame

I've begun my journey with game development a little while ago, thought recreating snake would be cool, except I plan on adding other cool mechanics and stuff to it later. The player controller script ...
Trevn Jones's user avatar
1 vote
1 answer
127 views

Start Screen for pygame

I'm making a Start Screen class for my game, it has 3 buttons and they're spread out horizontally on the screen. The screen also has a scrolling background, moves from top to bottom. It's a very basic ...
Trevn Jones's user avatar
2 votes
1 answer
131 views

Pygame (First time trying to implement OOP)

Recently I've been trying to learn more advanced things such as using classes and creating methods and such to implement OOP into my coding. This is the first time I've tried and I want opinion on ...
Trevn Jones's user avatar
4 votes
1 answer
2k views

Very simple Flappy 'Bird' game - First project in Python

I am a beginner in Python. This is my first project in Python (that I tried to complete). There is a grey square that acts as the Flappy 'Bird' with green obstacles spawning with random gap sizes. The ...
A Random Dude's user avatar
0 votes
0 answers
155 views

Pygame Texture Ray Caster

Recently I have been attempting to develop a ray caster in python pygame. I managed to get it to work fairly efficiently when using basic colors, but when I altered the program to use textures instead,...
Brownie's user avatar
4 votes
1 answer
346 views

2D Minecraft - infinite chunk system

I am making a 2d minecraft clone for a hobby. Here is my code: 2D_MC.py: ...
coder's user avatar
  • 179
2 votes
2 answers
358 views

Basic pygame program template

I have a basic pygame program that I use at the start of every project that involves pygame. The idea is every time I start a project that involves pygame I can copy and past and I can immediately ...
coder's user avatar
  • 179
5 votes
1 answer
258 views

2d minecraft with infinite chunk system

I've made a python game called 2d minecraft (guess where I got the idea) that has an infinite chunk system. I believe the idea I have is alright but my coding is bad and I have tried to improve it as ...
coder's user avatar
  • 179
0 votes
1 answer
1k views

Drawing a tilemap using python and pygame

I am creating a tile-map in python using pygame. The code I have (see below) works OK, but I was wandering if there were any ...
sbottingota's user avatar
2 votes
1 answer
97 views

Game of life(random generation, pygame)

I recently created game about life in python. First version of code was console, but recently I rewrote this game in pygame. I decied upgrade game and was added age of cells. But now I can see that my ...
Максим's user avatar
2 votes
0 answers
119 views

Snake game with constant time complexity algorithm

https://github.com/speedrun-program/constant_time_snake_game Memory efficient snake game with O(1) algorithm for snake movement and bug placement. Three grids are used: a grid representing the game ...
my_stack_exchange_account's user avatar
2 votes
1 answer
89 views

pygame bullet spawner

I am currently making a game for myself and i have a lot of code in a function which does almost the exact same thing with some minor differences. I was wondering if there is an way to optimize this ...
Fnzz's user avatar
  • 23
3 votes
1 answer
106 views

Tap-Type-Game in Python (fast-typer)

Hello everyone Last week I've started creating a little project for fun - TapType Game, I know there is a lot of things to make better, but what about my solution, can you give me some general tips, ...
KermitTheFrog's user avatar
20 votes
3 answers
4k views

Planetary simulation in python

I have created a program in python that calculates forces between bodies (i.e earth, moon and a hypothetical moon) and make them move according to the changes in velocity and forces. This is the code ...
Hale's user avatar
  • 303
1 vote
1 answer
48 views

Is this a correct way of doing ECS?

I'm trying to use ECS with Pygame and was wondering if I'm doing this right before I go any deeper than this. I've tried learning more about ECS but it's mostly in another language, which I could ...
Alex Ramirez's user avatar
4 votes
0 answers
410 views

Solar System simulation with real values in pygame

Inspired by TechWithTim, I built up the solar system including Pluto. I have added a camera feature, zoom feature and displaying information about the selected planet. Zoom in and out using arrow keys,...
RandomCoder59's user avatar
1 vote
1 answer
88 views

game in pygame but lots of functions with lots of parameters necessary to tidy up game loop [closed]

I'm making a game with Pygame in which the user can place machines that would output resources called producers and you can use those resources to craft items with crafters which you would then move ...
Amin Ali's user avatar
0 votes
1 answer
110 views

Snake game with Pygame

I created and finished a Snake using pygame (in Python) utilising feedback I had from a previous code review a year or two ago. I'm pretty happy with the current state and havn't identified any bugs ...
blib's user avatar
  • 73
2 votes
2 answers
154 views

pixelating images

I'm a hobby programer and I had an idea for pixelating images and I wrote it. I was wondering how would a better programer write the same function. I want to learn and I think that this would help me ...
FrankSintara's user avatar
2 votes
2 answers
347 views

Movement and collision function

I just want this code optimized to the max and I don't mind knowing if the optimization is pretty much at the max already or if I am doing movement and collision wrong. My game is a 2d Minecraft style ...
coder's user avatar
  • 179
2 votes
1 answer
352 views

Simulation of sand particle collision

I am making a module that allows you to create sand and simulate it. I have successfully done this, but it runs very slowly. I need this to be able to simulate at least 1000 particles, at a fps higher ...
susthebus's user avatar
3 votes
1 answer
147 views

python pygame snake game

I used numpy for the O(n) parts, but I didn't add any ability to change grid size because I still wonder if there's a way to make it better than O(n). main.py: <...
my_stack_exchange_account's user avatar
2 votes
1 answer
61 views

Conversion of ZX81 BASIC Game to Pygame

I got the idea for this code from an article on converting ZX81 BASIC to Pygame. Although some code was provided in the article, I implemented this myself. I'm pretty dubious about the approach of ...
Robin Andrews's user avatar
1 vote
0 answers
183 views

pygame with infinitely scrolling background - handling of sprites movement

In my current project I try to implement the basic game logic of the game "Vampire Survival" (Little impression of the first level can be seen in this video on Youtube). Question I want to ...
Rabinzel's user avatar
  • 111
2 votes
1 answer
168 views

Go chess (weiqi) in Python using Pygame

Preface This question is a re-implementation of my other question here. The Game Go or weiqi is an amazingly simple yet complex board game. This game is typically played on a 19x19 grid, and pieces ...
cold10's user avatar
  • 469
0 votes
1 answer
171 views

PyGame Event Handling

I'm new to pygame and tried to write my own Event Manager because I couldn't find a solution I was satisfied with. So I wrote my own inspired by the observer pattern: ...
lukstru's user avatar
  • 968
2 votes
1 answer
896 views

Slot machine game using python

I made a 3 reel slot machine using the pygame library in Python. This is what I have so far. I want to improve it to make it work for a 3x5 slot machine with multiple paylines, right now it is a 1x3 ...
Rangers_fan2022's user avatar
3 votes
1 answer
153 views

Asteroid-avoidance arcade game in pygame

Out of boredom one day I decided to make a game in pygame. I think it turned out fine, but am absolutely sure that it can be improved. How so? ...
CodeWizard777's user avatar
4 votes
1 answer
90 views

Weird things to do to an image

Here is a program I wrote to take an image and do weird things to it. Is there any more weird things I can add? Right now I have: Chop the image Flip the image (up/down and left/right) Rotate the ...
Jason Roman's user avatar
1 vote
0 answers
252 views

Python Sorting Algorithm Visualizer with Pygame

So I've written a Sorting Algorithms Visualizer according to this tutorial, but made some changes and add some features of my own. The visualization is made with Pygame (Which I never used before). ...
RedYoel's user avatar
  • 311
3 votes
1 answer
162 views

PixelArt made with pygame

I am a bit new to pygame, and I made this simple pixel art game. Is it possible to simplify, and is it possible to save your drawings and load them back again? ...
PythonCoder's user avatar
2 votes
1 answer
423 views

Robotic swarm simulation: aggregation

This program simulates the phenomenon of aggregation of a swarm of robots with no cooperation between each other and each robot following a very simple rule: The velocity of this robot has a random ...
Caridorc's user avatar
  • 27.5k
2 votes
0 answers
40 views

Pygame Rect sorting algorithem

I need to write a program where the user can switch between rect positions.( rects position re-ordering rellevant for activating other functions that not rellevant for this question.) My algorithm ...
benny hassan's user avatar
3 votes
1 answer
430 views

15 Puzzle in Pygame

This is a 15 puzzle implemented in pygame. The tiles can be moved with the arrow keys or by clicking and dragging the mouse. Parts of the code that require extra like icons and sound effects files ...
anonymous_pigeon's user avatar
1 vote
1 answer
44 views

When I try to re set up my code after failing in the game I cant get it to run the function without its own file being undefined [closed]

I know my code is ugly and unreadable. I originally had the game working without class functions but when I had to implement class function it all went downhill. TennisMaster.py ...
RobbieAwesome's user avatar
2 votes
0 answers
138 views

Connect 4 project for three players with PyGame graphics

I am currently working on a Connect 4 game for a project and it works. We added support so that it can be played by 3 players instead of 2. I know there is multiple instances of repeated code or un-...
Ibrahim Bholat's user avatar
2 votes
1 answer
171 views

Invaders clone made with Pygame

This is my first big project that I started after completing the Pygame Shmup guide put together by KidsCanCode. I'm starting to feel like it's very close to being finished so wanted to post my code ...
Dreadnought's user avatar
1 vote
1 answer
194 views

Python MP3 player with pygame.mixer and tkinter for MacOS

I made a Tkinter MP3 Player with Pygame and am looking for tips to improve. Explanation offered in comments in code, but it generally works by getting all the files in a folder. (Have censored ...
cold10's user avatar
  • 469
3 votes
1 answer
122 views

Pygame program made to look like NohBoard

This is something I made as an input display resembling NohBoard because I need to make a video for a video game, but it's on Linux which doesn't have any good input display programs. One thing I'm ...
my_stack_exchange_account's user avatar
1 vote
1 answer
436 views

A simple noise visualizer made using Pygame GUI

I was trying to make a simple noise visualizer using the noise, pygame and pygame_gui ...
Huy Truong Le's user avatar
12 votes
4 answers
3k views

Gomoku (Connect 5) game implementation in pygame

I attempted to implement a simple Gomoku game (connect 5) in pygame and wanted to get some help. So far, the basic features are working fine with 2 players going against each other. Entire Code ...
nightstand's user avatar
2 votes
0 answers
33 views

One data object instead of array of objects - why is it slower?

I'm currently writing a game of life with small extra features but I ran into a problem - in my first try i decided to use simple list of Cell objects: ...
kucu's user avatar
  • 21
6 votes
1 answer
214 views

Python's Pygame wrapper

Some time ago, I participated in a Game Jam using Pygame for the first time and I faced a few difficulties with some of its elements, notably the sounds and the events. That's why I decided to create ...
charon25's user avatar
  • 163
4 votes
1 answer
205 views

class that handles the rpg game map

I created a class to handle maps in my RPG game, before it became a class this was a collection of functions I created, but I thought it could be used as a class. although this code is working but i ...
syafiqfadillah's user avatar

1
2 3 4 5