ALIEN KID: A TOMATO SOUP
Alien Kid: A Tomato Soup it’s a platform 2D video game with a pixel art graphics currently in development, but you can play the first level below. This build have some bugs but it’s full playable.
Controls (Keyboard or Gamepad):
· Run – C (Keyboard) / X (Gamepad Xbox Scheme)
· Shoot / Enter Ship – X (Keyboard) / Y (Gamepad Xbox Scheme)
· Jump – Spacebar (Keyboard) / A (Gamepad Xbox Scheme)
· Movement – Direction Arrows (Keyboard) / Left Joystick or DPad (Gamepad Xbox Scheme)
DESIGN AND SPRITES
For the Game Design Document and the guideline of the development I think how make a easy video game (for me to develop it and the player to be funny), so I played some old video games of the same style to recover some mechanics and dynamics (MDA) and adapt it to the project.
The story it’s simple, Bobot it’s an alien for a far away galaxy who travel to return to his native world, but during the travel a problem in his ship make loose all technology over an undiscovered planet. His new mission will be recover all the technology scattered over the world and stay save from the creatures of the planet… ¡the crazy tomatoes!
The mechanics are like other 2D platforms video games, a simple movement with a run and jump with a shoot action, also move some boxes and trigger buttons to activate or deactivate walls, and for the enemies jump over to stunning it’s.
The objective of the player will find all the chips over the map and then return to the ship to go the next level, this at the same time will solving some puzzles, killing tomatoes and survive to the end of the level.
For the design of the character I made some sketches for Bobot and the tomatoes and I begin to made it in Piskel trying to look nice and funny. Also, for the tile maps I used Piskel has editor and I produced all the environment of the levels.
UNITY AND SCRIPTS
In Unity I used the URP 2D pipeline for more compatibility and best performance possible with the support of GitLab has repository (I use SourceTree has a manager). Also, I programmed all the scripts in C# with Microsoft Visual Code.
For example, I share a short view of the code I made for Bobot, and I explain a little bit how it works and other examples.
To Bobot detects the enemies when he jump over I used a Raycast2D type called BoxCast, this generate a box to detect the objects in collide with it. This is made this way because if Bobot enter in collider with his own BoxCollider2D he suffer damage by all the sides and also jump too, to avoid this situation this BoxCast makes Bobot jump and avoid any damage.
If we look shorter, between the lines 118 and 133 we can see this functionality in action inside Update(). This lines makes if the BoxCast detect a collider (with the correct LayerMask previously added in the line 114) with it, make a Rigidbody2D.AddForce with a AudioSource.PlayOneShot() and a change in the script of the object the BoxCast collide to make the enemy stunned and start a countdown to his recover (lines 125 to 126).
By other way, if the collider don’t detect anything in collide (it’s null) makes the boolean «EnemyHeadJump» false to avoid problems with the functions (line 130 to 133).
In the capture below we can see Bobot using this lines of the code in the Unity inspector and the scene preview. I we look closer we se a BoxCollider2D around Bobot and a little added box below. That was the BoxCast generated by the code we see above.
Let’s talk about how I synchronized the sounds with the animations.
For this part I used the AudioSource provided by default in the editor, the animation Events and some tweaks in the scripts. For this I share once a capture of the script made for Bobot and other with the Animation for see what done the function «StepDone».
First of all, we can see in the second capture the animation of Bobot running drive by a Animator, this animation if we look at the right panel (Unity Inspector), we can see it’s checked has a Loop and Loop Pose animation to continuously repeat the animation over the time.
At the top of every frame, under the number of frame we can see a little vertical white line called Events. This Events will running every time that frame plays, too I made once per frame called «StepDone» to implement the functionality in the script.
If we see the script, the function «StepDone» it’s writing between the lines 414 to 420. These lines made if Bobot it’s on the ground plays once an audio everytime the function it’s called by the Animator by AudioSource.PlayOneShot(AudioClip).