Pygame is a portable Python package for video games, built on SDL.
-1
votes
0answers
26 views
Why is this code not working? [on hold]
This is driving me crazy, I am working on a circuit simulation program, and every time I ask a question about it it gets closed, and I'm beginning to get very angry.
I seriously need help, but my ...
0
votes
0answers
12 views
Class being incorrectly identified? [on hold]
This code definitely needs some reviewing. I seriously can't figure out my error here.
I am working a virtual circuit creation program, where you lay down wires and other components to create small ...
3
votes
1answer
91 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 ...
2
votes
1answer
62 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 ...
6
votes
2answers
166 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
173 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 ...
1
vote
0answers
92 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
123 views
Basic Pong game in Pygame
I have just wrote this Pong game in Pygame:
import pygame
import sys
import math
class Ball(object):
def __init__(self, x, y, width, height, vx, vy, colour):
self.x = x
self.y = ...
0
votes
1answer
50 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
106 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
89 views
Making a Pygame game faster?
In my game, there is a terrain generator subsequently resulting in many instances. I have implemented this code:
for b in blocklist:
if b.rect.left>=0:
if b.rect.right<=640:
...
2
votes
1answer
129 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.
import pygame
import sys
class MainWindow(object):
...
1
vote
1answer
78 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
998 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
81 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 ...
2
votes
1answer
1k 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 ...
1
vote
1answer
229 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 ...
2
votes
1answer
4k views
Snake game — made with Python
I wrote a simple Python snake game, it's about 250 lines of code. Can someone give me some advice on how to refactor/make it better?
game.py
# game.py - 3/22/2013
import pygame, sys, os
from ...
2
votes
2answers
172 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 Paddle inherit from it. And ComputerPaddle is a child class of Paddle.
# ...
9
votes
1answer
848 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:
import pygame, random, time, sys
from pygame.locals import *
pygame.init()
NUM_SHAPES ...
8
votes
1answer
677 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 ...