Collision Detection and 2.5D w/ ImpactJS

The past week has been a blur, and I am trying to refocus so I can take on the next one. If you tuned in last week then you know I am steady trying to recreate the first level of “Scott Pilgrim: The Game” with ImpactJS. So far, it has been a little rough. I know that ImpactJS is a 2D game engine, but I am determined to get a 2.5D demo working. I don’t know why I am fighting the engine, but I like this one better than any of the others available. I know that the main issues I am facing will be resolved with either a different game engine or ImpactJS will expand into the 2.5D realm.

Collision Detection

Entity to Entity: In the last week I made improvements to the collision detection for enemies and the player. I am keeping all of the hit boxes for entities at their feet. In a 2.5D world the only things we really need to check for is hard collision at the feet. That would at least let us use the engine’s built in collision detection and we can program our own in for the rest of the body based on where the feet are. This may not suit everybody’s needs, but mine does not require pin-point hit detection.

Entity to Map: Because we can’t use the engine’s built in collision maps, there had to be a way to keep the player bounded.  There is now a way to create a bounding-box/collision-layer that dynamically changes in relation to the player’s X coordinate. This allows us to load in a level’s boundaries with JSON, and enable different boundaries for the player depending on their X coordinate in the level.  One of the reason’s for not using the built in map collision is because your player can’t jump with static collision boxes above them.  The new system allows you to turn off/pause the dynamic collision map while jumping, and resume once the player is standing.

Gravity

I was also able to get a hole/pit working with the game engine’s physics still controlling the player’s fall. One of the major issues I am having with tricking ImpactJS into a 2.5D world is the loss of the game engine’s built in physics. After playing with many ideas I came up with an OK solution that will do for now.  When the player hit’s a hole there are special tiles that detect this, and add gravity back to the game. The dynamic collision map is turned off at this point allowing the player to fall, and die.

Breakables

Another accomplishment this weekend was the edition of breakable objects. You can now break the safe box near the beginning of level1 , and I am slowly adding more breakable entities.

Signing Off

This past week saw many more additions, and fixes such as corrected player animations for left and right movement, new sounds for Planet Auz Zelda Heart containerattacking, many more objects added, custom enemy AI, and a scripted bus that makes a bus stop colliding with the player! The game development is moving along nicely, but there is soooooo much more to do. Check out the latest version and I will update you on the progress next time.  Thanks for tuning in, and I’m sorry for missing the beers this weekend PNate. You know I have become addicted to this stupid game.  Will put it on pause after the next life!

PS – Yes, that is an African-American version of Link.  And no… I didn’t HAVE to color change Zelda’s sprite. HA! Happy 4th of July you guys!

Click here to PLAY!

Please keep in mind this is a concept-of-proof demo. Much love to Paul Robertson and Bryan Lee O’Malley who’s hard work can be seen in the sprites of Scott Pilgrim and other games.

Leave a Reply

Your email address will not be published. Required fields are marked *