Minigame 2 - Peanut Shoot
Concept play and mechanics:
Much like the concept and mechanics process for the ‘Peanut Drop’ minigame, it was important to gain an understanding of the minigames gameplay and to break down the core mechanics that would be required for a successful testing. Andy was able to make an animation for the ‘Peanut Shoot’ minigame much like he did before.
Andy’s ‘Peanut Shoot’ Gameplay Concept
Animation.
The animation above breaks down as follows:
- The trunk at the bottom of the screen rotates ~30° from left to right.
- A crosshair follows where the trunk is pointing.
- When the player touches the screen, a peanut is fired out of the trunk.
- A peanut is removed from the peanuts reserve display.
- The peanut strikes the target in line with where the crosshair was when the player touched the screen.
- The impact leaves behind an imprint that shows the player where they hit.
- If the player hits the ‘X’ (Bullseye), a win menu pops up.
- If the player runs out of peanuts, they lose, and a lose menu pops up.
- Peanuts are rewarded to the player if they win.
At this
point there are still a number of unknowns that will be addressed further down
the road.
Development List:
1. UI Replication
The first step in the development of
the ‘Peanut Shooter’ minigame was to replicate the user interface. As the
player will be provided with the same number of peanuts (attempts), it was safe
to replicate the peanut reserve display as well. In the case of this minigame,
the text on the ‘Drop’ button were replaced with ‘Shoot’.
2. Crosshair
This minigame is built on the timing
of a button press and to assist the player in determining precisely when to press
the ‘Shoot’ button, a crosshair was required. I attached the crosshair to the rotating
trunk so that it would inherit its rotation. When the trunk rotates to the left
or right, the crosshair follows. The Trunk Rotation Script I
created previously for the ‘Peanut Drop’ minigame also includes a public
variable that allows the change of maximum rotation. I used this to ensure that
the crosshair remained on the target at all times by setting the maximum
rotation to 30°.
3. Gravity Script
I created a script that overwrites
the gravity of the scene to allow the peanut to travel without resistance. This
ensures that the peanut strikes the target precisely where the player was
aiming.
4. Boundary Collisions Script
To ensure the peanut strikes the
target rather than flying off the screen, I created a boundary script. This
script checks the collision of the peanut with an invisible object and when it
is no longer colliding it will destroy the peanut and instantiate a peanut
shaped hole at the hit position. The ‘X’ is placed on the edge of the boundary
so that the peanut can hit it before being destroyed by the boundary.
Problems:
Developing ‘Peanut Shoot’ has had a few
production complications so far. These complications include projectile velocity,
inverted trunk rotation, and target hit height.
The moment I tested the trunk shooting script the
projectile velocity issue was very prominent. As the projectile (peanut) has a
rigid body, physics are applied to it. In this particular case, the minigame
has gravity of 9.81 applied to it by default. This was causing the projectiles velocity
to decrease and eventually revert. Removing the rigidbody was not an option as
there would no longer be a way to add a force to the projectile when spawned. I
resorted to removing the default gravity of the Unity project and instead
applying a scene specific gravity script that would manually overwrite each scenes
gravity. Although this technically may not be the most efficient solution, it
does allow for future minigames to have varying gravity strengths.
After attaching the ‘TrunkRotate’ script to the
trunk I tested the minigame. The trunk began to rotate upside down, completely
on the wrong side as intended. After checking the ‘Peanut Drop’ trunk and rotation
script it was visible that I had made a mistake with the layering of the trunk.
The trunk is attached to an empty game object and inherits its rotation. This
allows the trunk to not only rotate on the spot but also move slightly from
left to right. Intended to appear more realistic as it is unlikely an elephant
moves the tip of its trunk like the animation above. After readjusting the
position of the trunk in relation to the empty game object, the rotation
functioned perfectly as intended.
Now that the peanut travels in the exact
direction it was fired, the next problem became visible. If the peanut did not
hit the ‘X’ (Bullseye), the peanut would continue flying off the screen rather
than hitting the target. This was fixed by adding a hitbox with boundaries in
line with the crosshair path. If the peanut leaves the boundaries, it is destroyed
and replaced with a hole. This solution has some buggy moments and may be revisited
at a later date.
‘Peanut Shoot’ Trunk Rotation & Impact Holes.
Future Inclusions:
I still have not included the curtain opening animation that Andy has made for each of the minigames, and I hope to be able to include this very soon. I anticipate that I will have to disable the user interface while the animation plays as the shoot button, peanut reserve display, and pause button are all a part of the UI and will be visible over the top of the curtain. This may require some time to script and is why I have been focusing on more important aspects of the project. At this point, sound effects and background music are still missing however, a file has been produced with listed sound effects that can be included in the upcoming weeks.
‘Peanut Shoot’ Current Product Development State.
Comments
Post a Comment