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

learn more… | top users | synonyms

1
vote
1answer
51 views

Tower of Hanoi: graphical representation of optimal solution

I wrote a program to show graphically the solution of the problem of the Tower of Hanoi. Here is a video of an example run. The logic of the solving is taken from StackOverflow (see links in ...
7
votes
1answer
76 views

Wrap a long string to an array of short-enough strings

I have made a function that wraps text in pygame (i.e. it turns a long string into an array of smaller strings that are short enough so they fit within the given width when rendered in the given font)....
8
votes
1answer
181 views

Pokemon battle simulator

I learned Python and Pygame and now have coded a few games. For the last few months I have been working on this "luck free" pokemon battle simulator. I feel my program runs well in the current state ...
6
votes
1answer
105 views

Flappy Bird clone

I am a beginner in Pygame (and programming in general) and tried to make a Flappy Bird game. It works fine, but I'm sure the code has a lot of scope for improvement. It is completely procedural, and ...
2
votes
1answer
78 views

1 player pong working

I have made this pong game as a 1 player game, versus the computer. however it is impossible to beat the ai. Any ideas to make the code better would be appreciated. ...
4
votes
1answer
153 views

Pygame Slideshow

I have written a basic slideshow program that uses pygame to manage the display screen. It cycles through all pictures files in the directory and sub-directories. There is a user configuration section ...
3
votes
1answer
71 views

Snake in Python Pygame

I just now got around to implementing a full snake game in Pygame. The player can move his snake with the arrow keys and as in the original, the snake continues to move in the direction of the last ...
3
votes
1answer
56 views

Pygame Flash Game

I managed to finish this game I am sure you have encountered before. If you run it there are instructions on what to do. Any code suggestions / improvements? ...
7
votes
2answers
109 views

Simple 'Space Invaders' clone

This is my second game, not yet finished but working. I've put so much time into it I wanted to get feedback before continuing. I always learn so much from those that comment. Whilst my first (still ...
2
votes
0answers
35 views

Avoiding multiple hits to Sprite by shifting Sprite to separate group

Would appreciate any suggestions or improvements, I'm sure there are many. Especially so on the way I've avoided multiple hits by the missiles; shifting the asteroid into a separate group to enable ...
6
votes
0answers
67 views

Grid displayer: Game of Life and Langton's Ant

Re-use Given that both the Langton's Ant and the Game of Life use a grid, I decided to code a generic grid_diplayer code and use it both for GoL (Game of Life) and ...
5
votes
1answer
87 views

Snake game school project using Pygame

I am making a snake game and I'm almost done but I want to make my code more organized so people can understand so how to do it. ...
4
votes
1answer
121 views

Pong in Python and Pygame

I'm new to programming. This is my first project where I tried to use object-oriented programming. I'm looking for all kinds of comments. ...
3
votes
1answer
112 views

Drawing a planetary system in Pygame

I am new to programming and mostly self-taught by following a few MOOCs and doing little projects. I have reached the point where I am trying to develop more complicated programs (numerical models at ...
6
votes
3answers
1k views

Beginner grid-based game movement engine

Tell me how I can make it more efficient, shorter. How I can make it adhere more to convention? Is there some stuff I'm doing that you would do in a better way? The main gist is that I create and ...
3
votes
1answer
78 views

GUI Elements for pygame games

I've been making games using the Pygame module recently. I've noticed that Pygame has no builtin GUI elements. To save time for me (and hopefully other people), I have created some very simple GUI ...
2
votes
1answer
98 views

Beginning of a tower defense game, using pygame

I'm currently working on my first project and I have been programming in python for 4 days now. I currently have a dilemma where my code is running too slowly. I don't want you to make a full review, ...
11
votes
2answers
190 views

Using the mouse to avoid asteroids and black holes

I have finished my first project for Python. I would be very grateful if you could check it and give me some feedback. Just simple game with possibility of replay. There are probably lots of mistakes ...
2
votes
2answers
45 views

Text font size adapting to space

In order to practice my programming skills, I am trying to implement a Button class, to use in pygame. I know there are libraries like PGU, I do this to improve in programming. I spent a bit of time ...
3
votes
1answer
137 views

Beginner's pygame Conway's Game of Life

Here's my implementation of Game of Life. I'm quite new to Python and would like to know how could I improve that code, especially in terms of performance, compactness and readability. ...
3
votes
2answers
55 views

Count number of occurrences of each word of text, display as circles of varying size

My focus was to have clean, structured code. It has to be efficient. The display doesn't have to look that good. The circles do overlap and sometimes the word doesn't fit inside the circle, but those ...
8
votes
1answer
171 views

Small Python class for Lindenmayer Systems

L-systems are basically rules for recursively rewriting a string, which can be used to characterize e.g. some fractal and plant growth. I wrote a small class to represent deterministic L-systems and ...
5
votes
1answer
278 views

Koch snowflake in Python with numpy and pygame

I've drawn a Koch snowflake with Python 3. I'm new to the Python world and would appreciate all feedback on how to make the code more Pythonic as I'm not used to these idioms, styles and modules. All ...
3
votes
1answer
587 views

Memory game using Python and PyGame

I am a beginner in Python and PyGame and wrote a memory game. I think there are lot of things I could have done better. I am looking for some advice on how I can improve the design and refactoring of ...
9
votes
1answer
135 views

ChickenDodger game written using Pygame

I just made my first pygame program, ChickenDodger, and I would like to know how I could make my code better. I think I did pretty good for my first time, except the way I added the 2nd egg. I do not ...
3
votes
1answer
140 views

Python 4 Players Snake Game

I would really like to hear out some suggestions as well as general response to the code I've written for 4 players snake game. It's my first time using pygame module, as well as trying to design a ...
8
votes
1answer
89 views

Simple top down shooter game

This one of my first Python games in PyGame I decided to make for fun. Basically, you control a from top down perspective and shoot people in a maze. This is the rewrite of the original code, and I'm ...
2
votes
2answers
86 views

Bricky - A Breakout Clone in Pygame

I've been working on learning Pygame and I made a Breakout clone. I'm looking for stylistic advice and overall suggestions for improvement. Controls are simple: - ← and → to move. ...
15
votes
3answers
738 views

Setting the scene for a role-playing game

I made some games in Pygame, but I am still new to making games. I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the ...
8
votes
1answer
488 views

Space Shooter made using Pygame

This is my first game made using Pygame of about 550 lines of code. Advice and suggestions are more than welcome. ...
6
votes
2answers
246 views

Sample Python dodger game

I got my game working for so far, however, I would like the game to run faster. It's running at approximately 26 FPS when most of the blocks come in; my FPS goal would be about 60 FPS. ...
3
votes
1answer
150 views

A way of keeping a constant game speed at any fps with Pygame

Normally the game speed with pygame is locked with the fps, so I attempted making a simple two classes that'd be super easy to use, to allow for the same game speed no matter what the fps is. For ...
6
votes
1answer
59 views

Passing two player objects to a class

I am a PyGame newbie and am learning as I go. I would like to become familiar with normal PyGame conventions. I would like you PyGame experts go over my code and let me know if there are any places I ...
1
vote
3answers
162 views

Collision detection algorithm

This is my second algorithm and I will try to make it as simple for you to understand how it works. It is pretty expensive and I'd like to make it more efficient. . It works by splitting a square ...
7
votes
1answer
273 views

Pygame version of my 3D Tic Tac Toe/Connect 4

I posted a question a while back asking for some feedback on the code of a game I made (it was limited to typing the input and drawing the output in ASCII). Now I've got it linked up with pygamef. ...
10
votes
3answers
333 views

Bunny and Badgers: A tower defense game

I made a tower-defense game in Python with Pygame called "Bunny and Badgers". You're a bunny and must kill the badgers before they come into the castles. You can use W, A, S, D and the arrow keys to ...
6
votes
1answer
458 views

Builder - A 2D Minecraft clone

I was poking around on my Raspberry Pi that I hadn't turned on or used in a while, and I stumbled upon this Python script that I wrote ~1.5 years ago, and I was intrigued. Essentially, it's a 2D ...
4
votes
1answer
141 views

Simple Snake with pygame

I've been reading Dive Into Python and I needed to actually program something before I forget everything I learned. So, this is my first Python project (apart from trying the basics and playing with ...
6
votes
1answer
70 views

Input processing/state machine function

I'm making a Mario clone in pygame and I have just wrote a function proccesses inputs and acts as a state machine for Mario. Everything is working just as I want it, but I was wondering if you can ...
7
votes
1answer
104 views

Game loop decorator for Pygame

I've built a simple decorator that wraps a function in a general Pygame game loop. It also allows for the programmer to set the tick rate. ...
3
votes
1answer
71 views

Class modelling for a shogi notation reader

I have made GPL software in GitHub whose purpose is reading shogi notations (shogi is Japanese chess). I have been told that my software modelling is underdeveloped in this question and advised to ...
10
votes
1answer
485 views

Pong game in Pygame

This is my first time trying OOP and I definitely made many stylistic mistakes. Please tell me how I should improve. Controls: w and s for player 1 ↑ and ↓ for player 2 The player with higher score ...
0
votes
2answers
69 views

Avoiding regexps abuse in generation of statements to be executed

I made a GPL project to read Shogi Western Notations that I made public in GitHub. The project works perfectly on Ubuntu. Please check README.md to check requirements. All this code works quite well. ...
7
votes
1answer
578 views

Running a version of Space Invaders

I made a program that runs my version of Space Invaders. I recently finished it. I just want to make it more pythonic, and streamline it so it uses less memory and performs faster. The basic outline ...
5
votes
1answer
939 views

Snake game made in Python

I made a snake game with /some/ code from thenewboston's tutorials when I had just started Python. I think it wasn't a good idea to start game development right away since I didn't even know if what I ...
3
votes
1answer
120 views

Discoknights game structure

I'm building a game with Pygame, a simple turn-based strategy game where on each turn a character can move and/or perform an action. I have a somewhat good structure for the game on the background, ...
5
votes
3answers
259 views

Pythonic implementation of Conway's Game of Life

I've just finished with my python implementation of Conway's Game of Life. Can I get some opinions on it? ...
9
votes
1answer
227 views

Block_breaker clone in pygame with simple edge detection

I tried to make this clone of brick_breaker on my own in one day. The source code and assets . However I have some concerns about the code so far: It uses simple edge detection code (as if ball goes ...
10
votes
3answers
689 views

Souped-up random walk terrain generator

I started learning Python a couple of weeks ago, and to test my new knowledge of Python, I decided to use Pygame to code a random walk terrain generator. ...
1
vote
1answer
960 views

Drawing a dashed line with pygame

...