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

learn more… | top users | synonyms

6
votes
1answer
70 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
51 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
48 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 ...
6
votes
1answer
51 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
40 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
50 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 ...
0
votes
2answers
60 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
71 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
130 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
81 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, ...
4
votes
3answers
134 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
174 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 ...
10
votes
3answers
500 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
295 views

Drawing a dashed line with pygame

...
4
votes
1answer
280 views

Pygame menu to launch games - follow up

Follow up of Pygame menu to launch games I rewrote most of the code per the one answer. I'm looking for further advice to improve to the code. I'm afraid some of the abstraction may be too Java-like. ...
2
votes
1answer
346 views

Pygame menu to launch games

I made a menu to display a list of games and their info so that they can be uniformly launched from an arcade cabinet like set up. I was asked to do it in Python so I learned python using this and ...
35
votes
4answers
8k views

Flappy Bird game clone for a beginners' programming class

I'll soon begin teaching a beginners' programming class. It's voluntary, so I thought I'd make it interesting by teaching Python programming and then introduce the kids to Pygame, so that they can ...
6
votes
1answer
55 views

Editing Surfaces Removing Color

So I have recently tried to load an image and save it, but remove all of a certain color. I'm running the program and it is running really slow, is there a more efficient way to edit an image? My code ...
0
votes
1answer
390 views

Is this Pygame projectile code efficient?

Just wanted a few opinions on whether this game's code is efficient, from looking at it, it does look a bit all over the place but I just don't know how to 'tidy' it up to say so. Would love to hear ...
6
votes
1answer
353 views

Tetris clone written in Python/Pygame

I have a medium-sized project here, and I would like some comments on the code. In particular I'd like comments on how well I'm handling OO-programming, my programs logic and whether you think my code ...
3
votes
1answer
132 views

Write and control Perlin noise for 1D

I'm reading this tutorial and it's the first time I try something this new. Here is my attempt: ...
3
votes
2answers
135 views

First Chess Project (ver 1.1)

I'd already asked for my code to be reviewed earlier here First Chess project) Full code Considering the suggestions put forth for that question, I spent a day and refactored my whole code. For ...
10
votes
3answers
320 views

First Chess project

I'd made a project using pygame in python around 3 months ago. This was my first big project after I started learning how to program in college. Now I'd like to know just how good my programming ...
4
votes
1answer
252 views

Making this Pygame code object-oriented

PYTHON 2.7- I want to make my code OOP. I also want feedback from you on correctness, tidiness, design patterns and so on. Here's the download link. It's not permanent but it's the best I have ...
3
votes
1answer
126 views

Any tips on speeding up this sandbox game?

I am working on an app: a virtual sandbox of sorts, a lot like the powder game. The problem is, when working with an app, you must deal with hardware limitations. Don't get me wrong, the speed isn't ...
8
votes
2answers
757 views

How can I shorten this paint program?

I am currently in a challenge with my buddy to see who can code a simple paint program in the least lines. The only requirement, is that the program must include an eraser. How can I possibly shorten ...
1
vote
3answers
323 views

How to make this SimCity clone more efficient?

I am doing my best to keep this code clean and fast, but as I add more to the game, it seems to get harder to maintain a frame-rate higher than 200! The game is essentially a SimCity clone. I ...
10
votes
2answers
300 views

SimCity clone performance

I am working on a SimCity clone, and I am noticing a drop in frame rate as I add more objects to my map, now this is expected, but, when I fill the whole screen, the game maintains about 300 FPS. ...
1
vote
1answer
240 views

Basic Pong game in Pygame

I have just wrote this Pong game in Pygame: ...
1
vote
1answer
219 views

Pygame using a dict to store objects instead of an array?

In my pygame game, I build a level by adding a bunch platform objects to an array called instancelist. Then pygame tests for each instance in instancelist and blits it's sprite over it's rect ...
1
vote
1answer
368 views

Pygame snap mouse to grid?

The game I am working with is a block game. It generates terrain and then allows you to freely mine and place blocks as you wish (sound familiar Cx) BUT! there is a problem. I have a code that snaps ...
3
votes
1answer
180 views

Making a Pygame game faster?

In my game, there is a terrain generator subsequently resulting in many instances. I have implemented this code: ...
2
votes
1answer
592 views

Object Composition

So I have this Pygame 3.3.2 code of 2 classes. I tried to make it as simpler as possible, but ofcourse to show the problems I have with thedesign. ...
1
vote
1answer
126 views

Text class: is this good?

Failing to get a solution to my problem from other people, I got tired of waiting and wrote this (rather rushed) Text class to deal with the text problems I've been having in Pygame. I wanted the text ...
7
votes
1answer
2k views

What about my Pong game?

Just looking for some pointers on how I could improve the code. This is my first game ever and python is my first language so it's bit messy but I'll be happy to explain stuff if needed. I'm kinda ...
3
votes
2answers
100 views

Spawning an alien to chase the player

I have just made a simple script which spawns an alien that chases the player. I want to move as much of the script into functions so as to minimize the amount of code, to make it run better when my ...
4
votes
1answer
3k views

Text-based adventure RPG inventory code

I am trying to make a text-based RPG in Python and Pygame. I need a way to manage my inventory slots. Currently, I have no way to find out what is currently equipped. I can only overwrite it, even ...
3
votes
1answer
1k views

GUI system in PyGame

I'm making a GUI system in Python for game development with PyGame. Right now I have a button that changes colors when you hover and click on it. My question is, is this code well designed or can it ...
11
votes
1answer
17k views

Snake game using PyGame

I wrote a simple Python snake game which is about 250 lines of code. Can someone give me some advice on how I can refactor/make it better? game.py ...
2
votes
2answers
572 views

Pong game in Python

I'm writing a pong game in Python and I created classes for the game objects. The top level class is Object, and Ball and ...
12
votes
1answer
2k views

A small Bejeweled-like game in Pygame

I would really appreciate a review of my first game. It is a Bejeweled-like game written in Python with Pygame: ...
1
vote
1answer
2k views

Tackling the TSP with a genetic algorithm

This is my first go at genetic algorithms, using PyGame for the visual representation. Is there a way to improve the speed of the code? Click to place a point, press ↑ to start looking for the ...
11
votes
1answer
2k views

Self-playing Tetris game

I have an extremely simple self-playing Tetris game which I coded up and I am looking to see how it could be improved. It would also be a learning curve for me to see how those much better than I am ...
3
votes
1answer
354 views

MP3 player for Linux

I wrote a Python MP3 player for Linux using PyGame, with a curses GUI and a mouse-only interface. It's purely for personal use. It hasn't been polished yet, but for now I'd like to know what I've ...