Questions tagged [pygame]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
31 views

Basic pygame menu with buttons

I'm new to python and newer still to pygame. In my attempt to learn, I set to make a basic menu with buttons. Here's my code: (note, ui_plate, is a system that the buttons are based on, it keeps all ...
3
votes
2answers
70 views

A simple Pygame that has a square move and jump

How does this Pygame code look? Is the run loop usually in a class? I'm a beginner and was wondering what the best format and structure is for using OOP in Pygame. ...
6
votes
1answer
55 views

Menu with buttons using pygame

I wrote this to teach myself how to make a menu with buttons and I want to know if I've done well and if there's any way to make it shorter and/or more efficient. ...
3
votes
1answer
33 views

A class and a function to create and light up buttons in PyGame

This is my first ever try at making reusable code. The function makes use of two images to give the illusion of turning on and turning off a button in pygame. I would like to know what would you do ...
6
votes
1answer
85 views

Optimizing a raycasting/voxelspace algorithm in Pygame

In the past three days, I've been developing a simple raycasting algorithm. I've made the renderer work as I'd like to. However, it is extremely slow (5 frames per second) because of two things (as ...
4
votes
2answers
71 views

Breakout clone in pygame

As a guy who started coding a month ago, I would like an honest review of my version of breakout that I created using pygame. ...
3
votes
2answers
80 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
40 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
87 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
106 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 ...
34
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
150 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 ...
3
votes
0answers
56 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 ...
6
votes
1answer
176 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
132 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
386 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
919 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
116 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 ...
5
votes
3answers
4k 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
166 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
188 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
2answers
100 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 ...
2
votes
3answers
881 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. ...
2
votes
1answer
94 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
1k 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
140 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
31 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
215 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 ...
10
votes
2answers
515 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 ...
1
vote
1answer
334 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/...
2
votes
0answers
85 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: <...
5
votes
0answers
287 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
68 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
811 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 ...
3
votes
1answer
716 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. ...
5
votes
1answer
100 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
95 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. ...
1
vote
1answer
133 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
163 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
108 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
433 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
247 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
1k 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
251 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: ...
-2
votes
1answer
403 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: ...
4
votes
1answer
87 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. ...
5
votes
0answers
258 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
419 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...) ...