Ninja Fight game built for competition

Ninja Fight game is a scrolling platform game that challenges one player to overcome obstacles and destroy the Enemy boss. The unique idea of this Game project is that the playing difficulty can be changed. There is a feature to select levels to 1-10. Additionally with the AI feature the game automatically recommends the difficulty based on how well the player did in the previous round. The recommendation can still be changed using the slider and the player can change the difficulty to whatever he/she wants. The following are the major features of the game which indicates the level of complexity in the code used to design the game.

Play video of the game narrated by Sai Pranav

Try playing this simple game

The main features of this games are listed below

  • Artificial Intelligence: The AI calculates the recommended value when the player wins by,  Prediction = Round((Difficulty – (Minutes taken * 0.8)) + (Hearts / 3)). It also calculates the value, Prediction = Round(Minutes taken – Difficulty), when the player loses. The difficulty level affects the gameplay by 
  1. Increasing the speed of the hammer (Difficulty * 5)
  2. Increasing the  speed of the shurikens (Difficulty * 5)
  3. Increasing the number of ninjas
  4. Decreasing the number of hearts to 2 (only for levels 4 – 6)
  5. Decreasing the number of hearts to 1 (only for levels 7 – 10)
  • Statistics: I have used clones to vastly reduce the number of sprites required (on average there are 150 active clones running), I have used many forms of loops. And many ‘if conditions’. I have used 1470 blocks, 62 loops, 21 custom blocks, 23 scripts and 95 variables. 
  • The player: The ‘Ninja’ player moves using the arrow keys and ASWD keys, player can roll using space to go to the nearest checkpoint by pressing the key ‘9’. GodMode has been created for judges to explore all the levels of the game by Disabling death of Ninja/ player. This mode can be activated using key ‘T’.
  • The Heart: The heart symbol depicts the health of the player and it works by setting the ‘heartnum’ variable to the amount of required hearts. 7 clones are made with ID’s 1,2,3,4,5,6,7. If HeartNum>Heart ID – 1 then the heart becomes visible. If the total health = 0 then it ends the game. If the heart’s health is 0 then it makes the player respawn.
  • The Shurikens(enemies): when the shuriken gets the ‘Shoot’ message it creates a clone. In a ‘Run without screen refresh’ my block the clone calculates all the values between its position and it’s target (the player) and saves them in a list. Then in a loop, the clone goes to the value in the list minus scrollX, this way it is possible to dodge it.
  • The Shurikens(player): When the M key is pressed the actual main shuriken sprite goes to the player and uses the same code(#4), but it calculates the values between the player and 127x (to its right or left) and then moves in the same way as the normal shurikens. As the main one is being used for this, the player can not spam shurikens as he has to wait for the main shuriken to finish its code.
  • Enemies(small): The enemies spawn using the normal code which uses local X and local Y values. They have a code, which changes the local Y to sin(counter)*multiplier: this causes them to jump up and down while shooting shurikens every timestep (2-difficulty*0.1 second). They also look at the player.
  • Enemy(Boss): The Boss spawns on the very right of the map by his code, he also looks at the player and he starts with 20 health. His health gets reduced everytime he gets hit with the shurikens. However, he summons his shurikens at a slightly varying timing as he waits ((Random between 1 to 1.5) – difficulty*0.1 second). The randomizer is added, so that he doesn’t fire in a predictable pattern and that makes it harder for the player to dodge his shurikens.
  • DeathObjects: The code for this works by using a loop to access the values of X and Y stored in a list and take the clone to (X,Y) position. The clone’s code is very simple, if it touches the player, it broadcasts damage. The water damage is actually the main sprite because it has to bob up and down and look like real water.


Popular posts from this blog

My Learnings from FTC

Press mention for the International success at MAKEX 2022

Brahma of Goa