Skip to main content

Questions tagged [pygame]

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

Filter by
Sorted by
Tagged with
4 votes
2 answers
259 views

I developed two custom UI components with Pygame: a Button widget and a Frame widget. After placing the Button inside the Frame, I encountered an issue with the Button’s collision detection. ...
Hossein TwoK's user avatar
6 votes
2 answers
503 views

This code requires: tile map exported as .csv file tile set as .png knowing tile size knowing the rows and cols of the tile set .png For example, this tileset has 2 rows and 6 cols ...
Hossein TwoK's user avatar
9 votes
2 answers
270 views

I’m a first-year IT student, and I’ve completed a working Blackjack game in Python as part of an assignment. I’d love to get some feedback on my code structure, readability, and comments to improve my ...
Goose's user avatar
  • 91
8 votes
2 answers
1k views

I have been working on a 2D block game. I like the progress I am making, but I would like to improve the performance and the overall quality of the code. The code and textures are stored in my GitHub ...
coder's user avatar
  • 237
7 votes
1 answer
125 views

I just wanted to put this out here and see what people think and potential improvements I could make. I've been learning spritesheets in pygame as I was really scared to use them as I thought they ...
ThisQRequiresASpecialist's user avatar
7 votes
2 answers
854 views

I have made up some evolutionary rules for a type of cellular automaton that uses numbers instead of the more common binary black or white cells. Rules in English: Takes place on a square grid that ...
R1s1ble's user avatar
  • 171
2 votes
2 answers
303 views

Follow up from this question. I have added a slower loading system that allows the main game to run faster but I still get under 30 fps with caves even if I allow the player to outrun the loading. I ...
coder's user avatar
  • 237
3 votes
2 answers
275 views

I am coding an Infinite 2D block world chunk system with physics for fun. I am worried mainly about performance and code structure. I found that when I added more Perlin noise it made the performance ...
coder's user avatar
  • 237
2 votes
1 answer
126 views

I am coding an infinite 2D block world chunk system for fun. I would like to improve performance, but I'm not that worried. Game.py ...
coder's user avatar
  • 237
7 votes
2 answers
1k views

I was ok with my pawn code but the rook code is very long and I want it to make the code shorter and cleaner and the same thing with my bishops, knights, kings and queens. ...
Hai Khuc's user avatar
4 votes
2 answers
197 views

I've developed "Element Fusion," a PyGame-based game inspired by 2048 but using chemical elements. I'm seeking feedback on: Gameplay mechanics Code structure and efficiency PyGame ...
Amirhossein Rezaei's user avatar
7 votes
3 answers
1k views

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
13 votes
2 answers
2k views

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
  • 237
6 votes
1 answer
173 views

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
140 views

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
  • 1,143
2 votes
1 answer
112 views

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
911 views

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
1 vote
1 answer
176 views

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
168 views

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
3k views

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
4 votes
1 answer
390 views

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

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
  • 189
5 votes
1 answer
343 views

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
  • 189
0 votes
1 answer
2k views

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
  • 1,143
2 votes
1 answer
124 views

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
155 views

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
117 views

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
128 views

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

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
65 views

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
7 votes
2 answers
521 views

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
149 views

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
1 vote
1 answer
139 views

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
  • 83
2 votes
2 answers
197 views

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
380 views

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
  • 189
2 votes
1 answer
405 views

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
176 views

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
90 views

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
3 votes
1 answer
234 views

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

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
  • 559
0 votes
1 answer
219 views

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
  • 1,048
2 votes
1 answer
979 views

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
182 views

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
116 views

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
2 votes
1 answer
313 views

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

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
455 views

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
  • 28.2k
3 votes
1 answer
92 views

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

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
66 views

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

1
2 3 4 5 6