Questions tagged [pygame]

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

Filter by
Sorted by
Tagged with
8
votes
1answer
5k 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
964 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
801 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 ...
10
votes
1answer
6k 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
1answer
556 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
990 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
88 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
3k 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 ...
8
votes
1answer
779 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. ...
11
votes
3answers
782 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 ...
7
votes
1answer
2k 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
1k 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
104 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 ...
8
votes
1answer
245 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
112 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 ...
12
votes
1answer
2k 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 ...
1
vote
2answers
81 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. ...
8
votes
1answer
4k 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 ...
7
votes
1answer
12k 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 ...
4
votes
1answer
257 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
674 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
346 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 ...
11
votes
3answers
933 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. ...
4
votes
1answer
4k views

Drawing a dashed line with pygame

...
5
votes
1answer
1k 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. ...
3
votes
1answer
2k 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 ...
59
votes
4answers
33k 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 ...
7
votes
1answer
123 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
1k 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
2k 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
835 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
235 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
879 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 ...
3
votes
1answer
600 views

Making this Pygame code object-oriented [closed]

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

Virtual sandbox game

I am working on an app: a virtual sandbox of sorts, a lot like 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 like ...
8
votes
2answers
2k 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 ...
3
votes
3answers
1k views

SimCity clone with PyGame

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! I believe that the culprit is a somewhat large <...
11
votes
2answers
487 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. ...
3
votes
1answer
8k views

Basic Pong game in Pygame

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

Pygame snap mouse to grid? [closed]

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 ...
5
votes
1answer
578 views

Terrain generator in a PyGame game

In my game, there is a terrain generator subsequently resulting in many instances. I have implemented this code: ...
3
votes
1answer
937 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
700 views

Text class for Pygame [duplicate]

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 ...
10
votes
1answer
4k views

Pong with Pygame

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
151 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 ...
3
votes
1answer
4k views

Text-based adventure RPG inventory code [closed]

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 ...
4
votes
1answer
2k 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 ...
23
votes
1answer
46k 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 ...
3
votes
2answers
3k 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
6k 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: ...