Tuesday, September 25, 2012

Day 22 - Another 8 Hours

Here's another full day of programming for me. I started to put in the star power up when I realized that I had already coded most of it! The file just wasn't included in my solution! Once imported I changed it to work with my new framework and bam, another new object. Getting Mario to actually become invincible was another matter though. It got me thinking again about collision detection and how to do it better. When 2 things on screen collide they both call the OnStomp, OnHeadbutt, or OnSideCollision functions depending on where each object is located on screen. Then each thing checks what it collided with and does the appropriate action... The thing is this collision detection really only needs run on objects which are moving (as un-moving objects will never collide with anything.) So for example if Mario headbutts a block it would enter the Mario class via OnHeadbutt(Block block), then Mario would react appropriately by stopping his upward movement, and finally it would call block.Activate() and the block would take whatever action it needs. This will be another setback because most of my classes will need re-written.

Then again, I could just leave it and continue on my merry way.

I also dug up a spikey enemy that I previously coded and got him working. Then I decided to add that invisible block which holds a 1-up in the middle of level 1-1. Currently it's just a regular block which isn't drawn on screen. Mario can still stand on it and it also blocks his horizontal movement... Yet another reason why I want to rewrite my collision detection...

I fixed a few other bugs and as a finish for the day I added all the objects to the first level. Aside from the special area through the pipe I almost have the first level completely finished!

No video for today...

No comments:

Post a Comment