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

learn more… | top users | synonyms

0
votes
0answers
15 views

Pygame; Ai movement? (Loz2 like) [on hold]

I am working on a game, or rather recreating Legend of Zelda 2. I have the platforming and attack stuff down for the player, but I am having trouble with AI movement. I managed to make SOMETHING but ...
0
votes
0answers
27 views

Error with variables in different functions and scripts [on hold]

My friend and I are making a game in Pygame for fun. I was trying to clean up the code by putting more things into separate scripts as functions. This is the main script, and the only function is ...
0
votes
1answer
37 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 ...
0
votes
1answer
33 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
73 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
55 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
67 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 ...
5
votes
1answer
309 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
72 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 ...
1
vote
1answer
530 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
142 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
1k 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
117 views

Is this class structure good?

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. # ...
5
votes
1answer
498 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 ...