Tuesday, July 3, 2012

Day 6 - Headbutt

Today I only had about 1 hour to myself. I got a little bit of reorganization and one new feature implemented.

First I fixed the drawing order of sprites so now Mario appears in front of all other objects like clouds and bushes. Next I added 3 methods to my tile class and Mario class: OnHeadbutt(), onStomp(), onSideCollision(). Eventually I will make a generic GameEntity class which holds these 3 methods, but for now they are simply copied into each class that needs them. When Mario hits a block from below, the OnHeadbutt() method is called and the block can respond accordingly. To test this I created a brick block which disappears when Mario hits it from below. Next I'll add some animation to it so we can see the pieces of the block fly away after it is destroyed.

The OnStomp() method will mostly be used by enemies since that is Mario's only way of killing them. It will trigger the death animation and also give the player points. Likewise the onSideCollision() will be used when a shell hits an enemy or when two enemies run into each other. I think implementing enemies is still a ways off yet, but the framework will be available.


No comments:

Post a Comment