LavaWhales



LavaWhales

Overview:

For Ludum Dare 29, an online game programming competition, I competed in a team of 4 programmers and an artist. The competition was from April 25-28, a three day competition that started Friday afternoon to Monday afternoon. I competed with the California State University Long Beach ACM team. For more information on who was on the team or to try out our game, feel free to visit this link!

Source Code



What is LavaWhales?

What’s the Game Like?

You are the last whale left. Defend your unborn calf against the relentless waves of unicorns, gnomes, squid, and boats. – Game prologue. As the game states, this is a survival game. Your goal is to stay as long as possible and to defeat the wicked gnome and squid.

The giant gnome that is located in the bottom right corner continues to spawn smaller gnomes that are propelled in your direction to hurt you. The squid is a powerful monster that hits you for 1/3 of your life. While you are trying to defeat these two creatures, there is a continuous wave of unicorns that move left to right of the screen that will damage you.

You can eat the fishes to regain your health and lava crystals to replenish your ammo. Ammo?! yes! You are a lava spitting whale! You can spit lava balls that can be used to damage the gnomes, squid, and unicorns. There are two main firing types: single fire and spread shot. Spread shot simply fires 3 single rounds in a horizontal pattern. Note that you also have an air gauge that will deplete as you submerge. You can collect air bubbles to recover your air gauge when you are below the surface.

Now that you know how to play the game, definitely go try it out and have some fun!

What Did I Do?

Camera:

A contribution I have done for this project was to implement a camera. A camera concept is used to keep the screen always centered on the whale no matter where she moves. The camera will also not move off the camera when the whale gets near a corner of the screen. This means that the screen will stop focusing on the whale and allow the whale to move closer to the edge of the screen but the camera focus will not move.

The camera was a new concept to me. I learned how to implement it by using this guide: http://nova-fusion.com/2011/04/19/cameras-in-love2d-part-1-the-basics/ Definitely check out the tutorial if you’re interested in working with a camera because this tutorial was really easy to understand!

Background Scrolling:

Another contribution that I have done for this project is to generate the background so that it is scrolling. Scrolling the background means that the image in the background is continuously moving in one direction. I had to create several different implementations for the background scrolling because we did not have a concrete idea. Two major designs was to have the background scroll at a constant pace and is not affected by the whale’s movement. The second design was to have the background scroll ONLY when the whale is moving. I believe we went with the first design.

I generated a scrolling background by have 3 instances of the same background image. I had the program initially draw the 3 images side by side in the game starting at x=0. I then had the program move all the images to the left by 1 or 10 pixels every frame; this depended on the speed at which we wanted the background to scroll. When an images reaches negative image width, I had the program set the new position to the previous image’s position + image width. This means that when an image reaches the left limit, it will reset to the right limit and begin moving left again. This will continuously show that the background is moving left and that there is no overlapping. There is no overlapping because lets say we have image’s 1 2 3 in this position: 1 2 3. The game will only see what is currently at position 2. When all 3 images move left, image 1 will move behind 3 and now a little bit of image 2 on its left side is off the screen and there should be a gap on the right side if the image is moving left. However you don’t see the game because image 3 is moving into the now empty spot on the right side to fill it up. WAIT! this concept works because don’t forget that image 1, 2, and 3 are all the same images and are moving at the same rate. This means that when image 2 moves 10px left, so will image 3. Because they are the same image, what the player sees is that the game’s background is moving but never changing! ta da! Try the game out and you will see what I mean!

Other / Closing Statement:

It’s been about a month since I have programmed the game. I did a lot of other tiny things but there is too much to list and explain. They include adding objects to the game like the air bubbles, creating a new animation when the whale moves in different directions, the gnome boss, and drawing the health, air, etc bars. Again, I cannot list and explain all of them. Overall, everyone put a lot of time into this project to make it successful. It was a fun project and I learned a lot from everyone. I am especially glad that I learned how to use a class library for Lua to do OOP in lua/love2d programming. I used everything I learned in this game to design and program my next game: Hungry Bunny. Because of this experience, I definitely would like to participate in more competitions, hackathons, and code jams to meet new people and learn great things. Hope you have enjoyed my documentation, thank you!