Questions tagged [pygame]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
53 views

Object-oriented cat-and-mouse in Pygame

I'm rather new to programming. So far I've only done some small coding tasks once every now and then, and this the first "bigger" project for me. I love the idea of object-oriented programming and I'...
3
votes
0answers
25 views

How can I make my Pygame Tic Tac Toe game better?

I have this code ready and it works just fine. But what are the ways by which I can improve this code? I have no CS background and this is my first coding project. I could not paste my entire code so ...
-2
votes
1answer
361 views

Get list of surrounding pixels of a pixel in pygame [closed]

I am doing some pixel operations in Python, which obviously uses a lot of processing power and makes the program extremely slow. I have these nested loops: ...
2
votes
1answer
46 views

Beginner's snake game in pygame

This is the first big project for me and I am not sure which is the correct way to structure the code yet. Is it okay to have so many classes and functions? What else should I improve? ...
4
votes
1answer
47 views

Gravity simulation using Numpy and Pygame

This is a simple gravity simulator coded in Python 3.7 using Numpy and Pygame. I was wondering if it can be optimized further. Initially I had coded it using pure Python lists, using nested loops to ...
33
votes
5answers
5k views

Beginner's snake game using PyGame

I am a complete beginner when it comes to programming and writing games and this is my first ever game. I made it with python 3 using pygame library. I would ...
2
votes
1answer
77 views

2048 game in Python 3

I wrote this 2048 game using Python 3 and pygame a few weeks ago. Since I'm getting into CS this summer, I would like to get some review on how I can improve my code in generel. Any tips and ...
4
votes
1answer
392 views

Mars Lander pygame

Here is my code about our final project in uni called 'Mars Lander'. The thing is that my code seems to be all over the place (more specifically in the 'main' function at the end of the code...) ...
3
votes
0answers
31 views

Pygame : processing speed independant image loop displayer

I made this in order to teach myself pygame. This displays an images loop at the same speed on any computer (It will lag on a slow computer). Is my time management good or do my datetime call could ...
1
vote
1answer
115 views

The start of a game in pygame, blitting images to the screen

The small bit of code below blits and image to the screen within a class. I call this 4 times to display the image 4 times, each image has a different y coordinate and doesn't need different x but ...
6
votes
1answer
161 views

Golf Physics “Game”

Continuation of this post I wrote a program in pygame that basically acts as a physics engine for a ball. You can hit the ball around and your strokes are counted, as well as an extra stroke for ...
1
vote
1answer
110 views

2-Player Tank Battle Game [closed]

I've created a 2-player tank battle game. The code however seems like it could be greatly simplified and there are a few issues. One of which is the hitboxes of the tank seem a bit unreliable. ...
1
vote
0answers
131 views

Card Game using pygame module

I implemented a card game using pygame, the game is a game of war and using png files that I made in Microsoft paint. I tried to keep the object classes as separated from the pygame module as possible....
5
votes
1answer
39 views

Locating an image file in a pyGame [closed]

I am writing a simple game with pyGame. Structure-wise, I have separated my game into several files: main.py # the main runner, it loads up the environment ...
8
votes
2answers
905 views

Golf game boilerplate

I wrote a program in pygame that basically acts as a physics engine for a ball. You can hit the ball around and your strokes are counted, as well as an extra stroke for going out of bounds. If I do ...
6
votes
1answer
80 views

Plotting terrain pixels with PyGame based on random NumPy array

I am experimenting with Perlin Noise and random map generation. I have a 2D numpy ndarray full of 16-bit floats called map_list that I call from the singleton ...
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
3answers
1k views

First Python program: Snake

I've started learning Python yesterday with the intention of studying machine learning. Before this, my experience with programming was exclusive to my first semester where I had a C course. I ...
4
votes
1answer
124 views

Python Pygame treasure hunt game

This is a python game that I am working on. It is a grid based treasure hunt game in which you collect coins from specific tiles (some tiles ask you questions in which you need to answer correctly in ...
6
votes
1answer
142 views

First OOP in Python 3: Pygame Pong

I have been studying Python for a few months and just recently decided to stop avoiding OOP and reworked a Pong game to a more object oriented style. Please tell me how I should improve my code. Some ...
2
votes
1answer
794 views

1 player Pong with AI

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

Pygame simulation of a production line

So my code works as intended, but suffers major performance issues every time I add a new object to the screen. The speed of my objects basically gets cut in half. All you have to do to observe this ...
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 ...
2
votes
3answers
648 views

Pygame maze game

This is my first attempt at python game in pygame. It's a maze game where the maze is randomly generated using Prim's Algorithm. ...
10
votes
2answers
388 views

Paint program made in PyGame

I am making a paint program in Python using Pygame. Right now the program is very laggy, and I wanted to get my code reviewed incase the reason is in the way I have written the code. EDIT: I was ...
2
votes
1answer
81 views

First Pong game

This is my first pygame project that I've worked on and wanted to start with something simple. Pong was, I think, a pretty good choice now that I'm done with it. I will continue to make improvements ...
4
votes
3answers
723 views

Simple text escape room game

I recently started coding and after learning a bit about functions and basics I tried to make a simple text escape room game. My code is working and the game functions as intended but I now there are ...
3
votes
1answer
114 views

Implementation of Game of Life in pygame

This is my first project in pygame so I am open to suggestions how I can improve my python/pygame skills. I have started programming in python couple of weeks ago and I really want to know what I am ...
1
vote
0answers
28 views

Converting 2D arrays into strings

I have this function which converts a couple of 2D NumPy arrays into strings and then saves them in a text file (grid, quality, <...
4
votes
2answers
191 views

Simple Python Pygame Game

I'm trying to make a simple game for a school project. Do you have any tips on how to simplify and beautify the code? GitHub ...
1
vote
1answer
295 views

Implementation of the Snake game in Pygame, with GUI

I wrote a simple Snake game in Pygame, with GUI. It`s my first Pygame game and one of my first projects in Python. My goal with this implementation is to make it bug-free with fluid UI and as fast/...
1
vote
0answers
59 views

Arabic Language lesson program Part 3

This is the third time I am asking for a review of this code (first time can be found here: Arabic language lesson program and the second can be found here: Arabic language lesson program Part 2). ...
2
votes
0answers
81 views

Object-oriented model of a machine gun using Pygame

I just started to use classes in Python, so I don't know all concepts, rules and conventions about it. I made a little program of a machine gun, which simulates firing by user's action. Here it is: <...
3
votes
0answers
210 views

Nibbles/Snake game in Python

I am a total beginner at Python, so I wrote a very simple snake game using pygame to get some practice with it. I also don't have too much experience with object-oriented design. Does the code ...
1
vote
0answers
628 views

Text-Based Adventure RPG with PyGame

I'm creating a text-based adventure game using PyGame. I plan on also implementing kind of a Pokemon/Final Fantasy style combat system that works with menus instead of commands, but I haven't started ...
4
votes
1answer
4k views
3
votes
1answer
570 views

Memory Game using Tkinter/Pygame

I'm very new to python and programming in general. For a school assignment, I made this Memory Game and would love to receive feedback from you guys. ...
8
votes
1answer
274 views

Animation of linear transformations

Coordinates Given a 2d space, we can fix a coordinate system to talk about transformations numerically. The red vector, that ends at (1, 0) and the green vector that ends at (0, 1) are called the ...
5
votes
1answer
99 views

Beginnings of a neuron simulation

I have 2 classes that do extremely similar things. The only differences are that they draw using different colors, and that one draws in the back. The classes ...
4
votes
0answers
86 views

Mouse Click Controlled Meteor Avoidance Game

Ongoing development of game. The player is controlled by mouse click to move upward. The goal is to avoid meteors for as long as possible. I would be grateful if someone could critique my code. ...
6
votes
1answer
150 views

Flappy Bird Style Game in Space Setting

Simple game where you control space shuttle with mouse click and try to avoid meteors moving in random speed toward you. There are some things I am still developing like rotation and menus, but wanted ...
2
votes
1answer
96 views

ball-game created in Python 3

This is a very simple ball game in which we have to avoid projectiles falling from the sky. This is my second project and first game. Please review and tell where I can improve. ...
5
votes
1answer
369 views

Simon memory game in pygame

I've been teaching myself python and I decided to make a Simon copy. Please let me know if there's anything notable that I should improve on. I understand my use of globals in some functions is ...
4
votes
1answer
222 views

Movement function for a Sokoban game using Python [closed]

I've been working on the functions that handle when a player's sprite interacts with either a wall (0) or say the crate to push (£) I'm just wondering how this looks and if there alternative methods, ...
3
votes
1answer
939 views

Server and client for pong game

This is a pong style game which is very basic but involves sending and receiving data using TCP. The data is encoded using pickle which seems to be very inefficient yet I am still using it. The ...
5
votes
1answer
216 views

Conway's game of life in pygame

I've made a game of life in pygame. I need it to get it to run as fast as possible. I've done everything I can think of. ...
2
votes
0answers
42 views

Checking surrounding pixels inefficiently in pygame [closed]

This checks surrounding pixels to my object's pixel: ...
6
votes
0answers
223 views

Game involving catching falling items

This is my first game. Everything in the game was created by me during this week - from assets, music and, of course, code. As I am new to Python I have wondered if the design template for this game ...
4
votes
1answer
86 views

Using Pythagoras' Theorem to Check Point Distance [closed]

I want to procedurally generate several points on a graph that are suitably distant from each-other. These points are meant to represent castles that are part of towns in the world-map of my game. ...
7
votes
2answers
4k views

Ping Pong game in pygame

I wrote a very simple Ping Pong game using pygame and everything worked out quite well. The only issue is the high CPU usage, which seems a bit strange. One thread is immediately occupied up to 100% ...