Saturday, 1 March 2014

Day Three: Core Gameplay

I'm 3 days in on the challenge and it seems to be going well. I now have a working core gameplay for a frogger game. At the moment it seems to be a complete gameplay for a frogger but with no difficulty setting yet. Here's what the game has now:

- The frog can move around the level with no problems so far
- The frog dies when it hits a badger or a snake
- The frog can hop on the lilypads and dies if he falls over
- The frog can go to his home now
- The frog respawns
- The GUI elements are set with the number of lives decreasing, the score goes up and the timer goes down. I give credits to codeman38 for the nice arcade style font:

There is no game over screen yet but the hi score is working as it should be. The checklist for day 3 are:
- Frog home
- Frog lives
- Respawning
- Additional moving objects - snake, bunnies with arrows, a rock

I have added a new moving object - the snake. It spawns in the river but as it is a snake it may as well be able to spawn in land but I didn't implement that yet. for now since there's no difficult setting yet, I've set it so that every 1 in 10 a snake is spawned instead of a lilypad. I'll do another snake for land and the middle land too on the next day. Recolouring and resizing should give it a different feel.

For the respawning of the player frog, I scripted a FrogDeath script and put it as a component of the player object. Everytime there is a collision triggered when the player collides with a moving object the Die function is called, this is only for the bad guys because when a collision is triggered with the player and lilypad the moving platform behaviour is called. When the player dies there is a 1 second delay to play the death animation before respawning the player which is the same on the original frogger. I'm also resetting the camera position after the death animation. The ways that a player can die now are:
- when the player collides with any bad moving object
- when player/frog falls off to the river
- when player hits the bushes that separate the frog homes
- when the player moves away too much on the side of the screen on the upper/river section

The frog homes we're simple enough to implement, although I am not tracking the number of homes activated yet which will be a job for the next day. I placed a trigger on the position home, one for each and when the frog collides with the trigger, the frog is removed (not killed), the trigger is replaced with an image of the frog to signify that the home is activate, and after a 1 second delay I respawn the player frog at the bottom to start for another round and another home to activate. This implementation is the same as the FrogDeath script, it is called FrogWin.

After doing the frog home and respawning of the player, I went on and did the GUI elements. There are four main GUI elements in classic frogger game and these are the score, hiscore, lives and timer. The way I did the GUI is by creating another camera on the scene and named it GUI Camera and positioned it on a separeat coordinates than the main camera. I then position all the needed GUI elements on the second camera (GUI Camera) and making sure that the depth of the GUI camera is higher that the main one.

This implementation of GUI works great for the setup of this type of game since the main camera never really moves much and you can see everything with this and not on a separate GUI layer which is only seen when you hit play. To access all the needed variable in the scene for the GUI, I created a GUIParameterManager which manages all the needed variables for the GUI and of course of the scene. The Manager script handles the increasing and decreasing of lives, increasing of score and recording of hi score and also handles the timer. Basically, all of the variables that's needed for the gameplay is managed in the script.

This is so that I don't lose any of the important parameters of the game especially later for difficulty setting. If any event happens on the scene, i.e. the frog dying, this script is called and updated. Singletonizing the script might be a good idea since there's only ever gonna be one copy of the said script. I need to implement this later.

With all that done in Day 3, I have now a playable game, albeit still a boring repeated play but it's a start. I still have 5 more days or rather 5 days left before the release. I decided to have the last 2 days as the release day for PC and Android since I still need to prepare the game for me to release them on each platform. Additional features of the game will now be added from here on.

- Frog home activation for difficulty setting
- Increase difficulty up to a level of 5 then repeat
- Game over screen?
- Land snake moving object.
- Extra score objects - lady frog and flies.

Here's a link to a playable web version of the game. NOTE: it will be removed when a new version is up.



No comments:

Post a Comment