erszcz / agrajag

Automatically exported from code.google.com/p/agrajag
0 stars 0 forks source link

Propose and implement mechanics to deal with off-screen objects #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some objects should be destroyed immediatelly after leaving the screen.
Other should not, as they may return to the screen later.

It has to be taken into account that objects may be spawned outside of the
screen. For simplicity it may be assumed that each spawned object will
eventually enter the screen.

A way to obtain screen size by game objects must be invented.

Original issue reported on code.google.com by tomasz.szymczyszyn@gmail.com on 26 Dec 2007 at 11:15

GoogleCodeExporter commented 9 years ago
Each AGSprite is characterized by offscreen_lifetime, that is maximum time it 
can
spend off the screen without returning to it. If offscreen_lifetime is reached
AGSprite is killed in its update() method (self is set to None to inform 
subclasses'
update() methods that they should not do anything with the object).
Offscreen_lifetime can be set to None to turn off this behaviour.

AGSprite holds screen size in its screen_size attribute. AGSprite's 
is_offscreen()
method can be used to check whether object is completely off the screen or not.

Original comment by tomasz.szymczyszyn@gmail.com on 6 Jan 2008 at 1:30