[Tutor] a pyball python app

Kent Johnson kent37 at tds.net
Thu Apr 3 13:35:14 CEST 2008


dean garrad wrote:

> i am currently trying to edit a python app
> 
> it is a normal green ball game that comes with python it uses nokia n95 
> accel to move around.
> 
> i have been trying to make more than one ball on the screen at the same 
> time .
> 
> do you think it is possable ?

The attachment seems to be a modified version that moves text around on 
the screen, not a ball.

The program uses global variables to hold the state of the moving image, 
in particular the lists that hold location and speed. Adding a second 
image while keeping the same programming style would involve a lot of 
code duplication. What I suggest is to create a Ball object that holds 
the location and speed of the ball. The movement code could also go into 
the Ball class. Get this working with one ball. Then it should be pretty 
easy to add a second ball.

Kent


More information about the Tutor mailing list