First Person Fruit Ninja
Lauri Leppik, Kaur Veere, Martin Koltsov
Repository link: https://github.com/laurileppik/FP-Fruit-Ninja
Initial executable file: https://drive.google.com/drive/folders/197oJB2GfUmJ4YCVmRhbMXpJwDhv0-U1j?usp=sharing
Final release executable file: https://drive.google.com/drive/folders/197oJB2GfUmJ4YCVmRhbMXpJwDhv0-U1j?usp=sharing
Video:
How to run the project:
- Download the zip file
- Extract the zip file
- Run the Fruit_Ninja_1st_Pers.exe file
Description of the project
The goal of this project is to create a fun first-person version of Fruit Ninja. The idea is to implement a realistic cutting animation using procedural geometry, allowing players to slice through fruits in mid-air, avoid bombs, and aim for high scores. The player will use their mouse to slice the flying fruits. Bombs will be randomly thrown into the mix with the fruits. Points are awarded based on the number of fruits sliced.
Inital Progress:
- Set up the inital arena where the game will take place.
- Added initial models for banana, bomb, orange, watermelon and strawberry.
Final Release:
Added fruit slicing with procedural meshes
When the player makes contact with a fruit (slices it), the following happens:
- The fruit mesh is procedurally divided into two halves based on the slice plane's position and normal
- The sliced halves are activated with physics simulation, applying impulse and angular velocity to create movement and separation of the pieces.
Added physics for fruit spawning and flying
Every 1.3 seconds (this number seemed to work best for our intentions) a fruit actor is spawned. Its position is based on the position of the player. Each fruit's spawning position is calculated like this:
- Take the X and Y coordinates of the player
- Decide on the Radius for the circle around the player where fruits will spawn. 500 made sense to us.
- Calculate X Offset = Radius * cos(RandomAngle) and Y Offset = Radius * sin(RandomAngle), where RandomAngle is a random angle from 0.0 to 360.0 degrees.
- Calculate the X and Y spawning coordinates: X = Player's X + X Offset, Y = Player's Y + Y Offset
- The Z coordinate is a constant, that is slightly lower than the player's position so that the fruit would start spawning from under the player.
After all of this, we make a vector out of these 3 coordinates and this is the spawning position of the fruit.
Added scoring
Every time a fruit is sliced, the player is awarded with 100 points. If the player slices a bomb it's game over, the player loses and a losing end screen is displayed. If the player manages to get 10 000 points a winning end screen is displayed.