← Back to team overview

logame team mailing list archive

Re: Scrolling / Tiling

 

Hi,

Am Dienstag, den 20.10.2009, 14:21 +0100 schrieb Paul Elms:

> Nice work!  The dead enemies weren't scrolling with the background for
> two reasons:  Firstly, because the dead enemies are removed from the
> level.enemies list, you needed to add the new dead_objects list to the
> Scroller.scroll() method and call each objects scrolling method from
> there.  Secondly, In GameObject.scrolling() you added a return if
> self.status was DYING, so the scroll could never occur for dying
> objects.
> I have committed these changes for you :)
Thanks for the support, I thought just not scrolling these objects would
help.
> 
> I have also just committed some modifications to the way you set out the
> collision detection between shots and enemies.  I thought it would be
> cleaner if all the collision detection was done in one module, so I have
> created a CollisionDetector class and moved your shot and enemy
> detection in to there (with some modifications :p).  I have also put in
> collision detection between shots and tiles and player and
> collectables.  
That's a pretty good idea, I think there are several places in the code
base which could use a refactoring. :-)
> Now all game objects have a generic handle_collisions method that is
> passed a list of all objects colliding with that object, for it to deal
> with.  So, your Shot.hit_object method has been generalized into
> Shot.handle_collisions, I hope you don't mind:)
No absolutely not, I appreciate it.
> 
> Also, detection of the ground by the player is now done, so if the
> player is started above the floor he now falls until hitting the floor.
> I have also have begun implementation of tile vs player collision
> detection so the player will soon be able to jump onto blocks and get
> stopped by them.
There's also the collision between the player and the opponents, which I
would have suggested to lead to a instant death. I could go for that
feature together with pausing/(quitting/restarting) the game when the
player has no lives left.
> 
> > Thanks,
> > Ben
> > 
> > PS: Sorry I committed that code on the main trunk, I forgot to create
> > a branch for it. 
> 
> No problem, that only causes problems if other people do it too :)  I
> have found it good to use multiple local branches, one for bugfixes, one
> for collision detection.  That way if I find a bug while working on a
> feature, I can quickly fix the bug in the bug branch and commit it
> without worrying about the state of my code in the feature branch.
I followed your example and created a branch for feature development
right now. Hhm, that means no excuses will count next time. ;-)
> 
> Paul
> 
> 




References