Bonus Features 2 - Share your Work

Exercise

Beginner

+60XP

1h

Unity Technologies

Bonus Features 2 - Share your Work

In this tutorial, you can go way above and beyond what you learned in this Unit and share what you’ve made with your fellow creators.

There are four bonus features presented in this tutorial marked as Easy, Medium, Hard, and Expert. You can attempt any number of these, put your own spin on them, and then share your work!

This tutorial is entirely optional, but highly recommended for anyone wishing to take their skills to a new level.

Languages available:

1. Overview

This tutorial is entirely optional. If you are not interested in this extra challenge, simply scroll to the bottom of the page above the Submission Gallery and select "Skip submission and continue". You can still successfully complete the course without attempting any of these bonus features.

This tutorial outlines four potential bonus features for the Feed the Animals Prototype at varying levels of difficulty:

  • Easy: Vertical player movement
  • Medium: Aggressive animals
  • Hard: Game user interface
  • Expert: Animal hunger bar

Here’s what the prototype could look like if you complete all four features:


The Easy and Medium features can probably be completed entirely with skills from this course, but the Hard and Expert features will require some additional research.

Since this is optional, you can attempt none of them, all of them, or any combination in between.
You can come up with your own original bonus features as well!

Then, at the end of this tutorial, there is an opportunity to share your work.

We highly recommend that you attempt these using relentless Googling and troubleshooting, but if you do get completely stuck, there are hints and step-by-step solutions available below.

Good luck!

2. Easy: Vertical player movement

Allow the player to move forward and backwards within a certain range.

This makes the game a bit more dynamic and allows for the addition of other features.

3. Medium: Aggressive animals

Have animals that also spawn from the left and right side of the screen. If one of them hits you, “Game Over” should be logged to the console.

This will make the game much more exciting and requires the player to stay on their toes, especially if vertical movement is also implemented.

4. Hard: Game user interface

At the start of the game, display in the console that the player’s Lives = 3 and Score = 0. If the player feeds an animal, increase and display the Score. If the player misses an animal or is hit by one, decrease and display the Lives. When the number of Lives reaches 0, log “Game Over” in the console.

5. Expert: Animal hunger bar

Display a “hunger bar” on top of each of the animals. Then, each time you feed one of them, the hunger bar fills up a little. Each animal should require different amounts of food to successfully “feed” them. They should only disappear after their hunger bars are full.

6. Hints and solution walkthrough

Hints:

  • Easy: Vertical player movement
    • Look at how we are doing the left and right movement range.
  • Medium: Aggressive animals
    • Look at how we are currently spawning animals and doing collisions.
  • Hard: Game user interface
    • You will need to update the score and lives in the DetectCollisions script, and update the lives in the DestroyOutOfBounds script.
  • Expert: Animal hunger bar
    • You will need to add a UI Slider object in World space Render Mode as a prefab for each animal, then set the slider’s value through a script every time the animal is fed.

Solution walkthrough

If you are really stuck, download the step-by-step solution walkthrough.

Note that there are likely many ways to implement these features - this is only one suggestion.

Optional step

7. Share your work

Have you implemented any of these bonus features? Have you added any new, unique features? Have you applied these new features to another project?

We would love to see what you've created!

Please take a screenshot of your project or do a screen-recording walking us through it, then post it here to share what you’ve made.

We highly recommend that you comment on at least one other creator's submission. What do you like about the project? What would be a cool new feature they might consider adding?

Please login to submit

Complete this Tutorial

Submission Gallery

Project 2

Project 2

Feed the Animals is a fast-paced, top-down 3D arcade game where players control a farmer defending their field by feeding incoming waves of hungry animals. Navigate the arena in all four directions to launch food projectiles at animals charging in from the top and sides, filling their hunger meters before they breach your perimeter or collide with you.

D
Druvv1135
0
0
My Prototype 2

My Prototype 2

Features added All challenge features UI that keeps track of score and player lives Restart button on gameover 2 types of carrot for stampeders (grazing animals) and meat for the predators that attack from the side left click for carrot, right click for meat predators cause a blood particle effect to appear then delete itself after 1 duration both predators and stampede animals can be spawned in random sized groups or set to 1 each. vid1 1 animal, 1-3 predators vid2 1-3 animal, 1-5 predators I didn't like how multiple animals would spawn in the same spot or within .5 units to either side causing massive clipping so my script creates a list of vectors from minX to maxX by 2 unit increments, Top row vectors are removed from the list when an animal spawns and the vector is added to a Vectorcooldown list with a corrisponding float list for the cooldowntime. the float list is checked in update and every value in the list is reduced by deltaTime, when it reaches 0 its corrisponding index on the vectorCooldown list is removed and added back to the main spawn list. the side spawns are different, the side spawns are based on min/max z with 3 unit increments. they also had their x value *= -1 to create a mirror point for the other side of the screen and both are added to the sidespawn list with a corrisponding quaternion to give the spawned predator an appropriate forward for it to follow the mirror quaternion.y *= -1 as well. Since there is much fewer side animals and they have a changing rotation requirements i just added the chosen vector and its mirror(no head on collisions from opposite sides) to a blacklist that each spawnRandomPoint checks if its on the list it rerolls until it finds a vector that isn't on the list then spawns the animal at that point and uses the corrisponding index of the quaternion list to set it rotation. End results of this list stuff? A much more organized and cleaner look IMO.

M
Mystomex
4
0
Round Feeding

Round Feeding

prototype 2 bonus challenge

T
tanunajoel0
4
0
The Good Farmer

The Good Farmer

This challenge took much longer than expected, but it was totally worth it! I learned just as much as I struggled with this exercise 😅. I couldn't get the health bar slider to reference properly from the Inspector, so I decided to do it directly from the script instead, which turned out to be much more practical. Every hurdle is a new lesson learned!

A
Adrian_Arjona
24
0
Junior Programmer - Bonus 2

Junior Programmer - Bonus 2

This is a bonus project from the Unity Junior Programmer Pathway.

J
jessicatavares96
16
0
Animals Feeding

Animals Feeding

Animals Feeding

P
pumple666
8
0