Game 5: Glub, glub, glub

Hi! Happy New Year!

(Before I share the link to the latest game I just wanted to say I think these are going to all have to be played on a desktop browser unless noted. I tried making them usable for phones and tablets but it seems to distract from the game making part of this project.)

A yellow submarine!

This is not nearly as fun as the plane flying game (game4) but I learned a bunch of things on this project and I got to try some things I wanted to learn:

Things I learned:

  1. Natural is better than fake! Originally I was trying to draw a string of bubbles as you changed direction. I was stringing them in a complex diagonal pattern depending on which direction you’d changed and then suddenly it hit me that I was trying too hard. I scrapped that bit of code and just spit them out one at a time as you moved and they were drawn in a more pleasing way. Pretty much the way I was trying to imitate them but I think it looks better.

  2. Pink as a way to find mistakes. Back when I used to make websites, rendering HTML elements with 1px solid pink outline was a simple way to figure out what your elements were doing. Why one was crowding another or even if the size of one element was what you were thinking it was. I did that here in a few places and it saved me from some headache. Solid pink really sticks out.

  3. Draw on paper first. I’m doing some very quick shuffling of backgrounds to achieve an infinite left-right scrolling game. Behind the scenes I’m really just showing two different solid squares alternating as you move right or left BUT ALSO providing a small amount of space in the center where the background doesn’t scroll. I tried doing this in code first and kept making mistakes. It wasn’t until I just drew it all out on paper that I hit upon a really simple way to track the player and background. The same thing happened for the bubbles. Once on paper I learned how to make them stay in place even as I scrolled away and came back. (I’m pretty proud of how those bubbles stick by the way)

  4. Detect when keys are down, not when pressed. This is something I found in another person’s code. Previously I was waiting for key input and then moving my game pieces. If you played the plane game you would notice that if you were steering the plane and tried turning on the smoke it would stutter since it was now running the start smoking code. This new way makes for much smoother controls. I went back and altered the plane game to use this new steering technique and I think it’s much better.

I hope you have a good new year’s eve and are enjoying your time off. I’m going to go back to dungeon stuff next. Part of why I wanted to learn these types of frame-rate games is that I do want to do dungeon games with animated torches or monsters. So the next one is going to incorporate all these ideas into a game idea a friend suggested…