logame team mailing list archive
-
logame team
-
Mailing list archive
-
Message #00039
Re: Scrolling / Tiling
Hi Ben (and list :))
On Mon, 2009-10-19 at 22:36 +0200, Benjamin Klüglein wrote:
> Hi,
>
> I submitted some code to make the collision detection between shots
> and enemies work. I wanted to make dead enemies visible for a short
> time. The only thing I couldn't find was that dead enemies are still
> scrolling. Could you have a look at it please?
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 :)
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.
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:)
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.
> 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.
Paul
Follow ups
References