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

learn more… | top users | synonyms

6
votes
0answers
35 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. However I have some concerns about the code so far: It uses simple edge detection code (as if ball goes out of screen <600 or ...
10
votes
3answers
412 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
102 views

Drawing a dashed line with pygame

...
4
votes
1answer
130 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
134 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 ...
32
votes
4answers
5k 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 ...
1
vote
0answers
30 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
265 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
291 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
90 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
125 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 ...
8
votes
3answers
265 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
210 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
111 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 ...
7
votes
2answers
566 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
291 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 ...
2
votes
0answers
182 views

How can I make this SimCity clone faster?

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

Basic Pong game in Pygame

I have just wrote this Pong game in Pygame: ...
1
vote
1answer
142 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
323 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
158 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
439 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
111 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 ...
6
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 ...
1
vote
2answers
91 views

In this script what can I turn into funtions and how can I go about doing it?

I have just made a simple script which spawns an alien that chases the player, but I want to move as much of the script into funtions so as to minimize the amount of code, to make it run better when ...
3
votes
1answer
2k 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
799 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 ...
10
votes
1answer
13k 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
409 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
1k 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 ...