Friday, March 11, 2016

Week 5

This week, Alex and I continued to work out some more game mechanics not included in the base MelonJS engine. My biggest task was to figure out how to make tiles like spikes and acid hurt the player character. After searching the base engine for where different Entity objects were added to the pool, I couldn't find anything other than some mentions in the comments. Discouraged, I looked to the comments as a sort of last hope. It was so strange to me, there were multiple references to a code snippet that was not present anywhere in the MelonJS.js file, where the engine is contained. I figured that the code snippet would have to be somewhere, so I searched other files within the game folder. Eventually, I found such a snippet in the game.js file. I was ecstatic. It would work now. And it did! The game stopped crashing when I walked next to the spikes. Now the game only crashed when I walked on the spikes.

I went back to the portion of the code where I referenced the collision between the tile and the player character. It just wasn't working at all, so I did some research on the internet. Turns out I needed to create a COLLISION_TYPE for the newly-created tile class. I did that, but it still wouldn't work. Apparently the one I just created wasn't enough, it wasn't a "valid collision type". Turns out I had to register the collision type just like I had to register the class itself. Fortunately, the location to register collision types in the engine was more conveniently-located, so I wasted a lot less time with this. After registering the type, everything went smoothly. I extended the level I had been working on previously some more, and that pretty much wraps up my fifth week.

http://frobotgame.com/

8 comments :

  1. Your game has come a long way! So now if the player steps on spikes will the game restart or the specific level restart?

    ReplyDelete
    Replies
    1. I agree with Sparshee! The Frobot game has come a long way. I love seeing the new updates each week. Do you plan to build the story of Frobot more into the game? As a player, I wonder who the enemies are and what can I use my coins for?

      Delete
  2. Coding can be really frustrating sometimes. Glad to see that you're not giving up. The level looks great!

    ReplyDelete
  3. Sounds like coding can be a total drag sometimes. But I'm happy to see that you've made so much progress!

    ReplyDelete
  4. Wow the game has definitely improved since I last played! That's the awesome and frustrating thing about coding: everything is online, but sometimes difficult to find.

    ReplyDelete

Copyright © Totally Radical: Creating an Old-Fashioned Video Game with Modern Spunk

Distributed By My Blogger Themes | Blogger Theme By NewBloggerThemes Up ↑