Bonus Challenges: Day 4



These optional challenges build on what we did in class!
You can also do challenges from previous days!

Make some original graphics for your game


By the end of the week, you should have original art assets in your game, including environment art, characters, items, and more! Start thinking about the theme of your game and working on a tileset. Refer to the MAKING YOUR GAME LOOK GOOD document for some tips.

Add sound and music to your game


︎︎︎ Tips:
  • Use the AudioSource component to play sound effects. Turn on “Loop” for looping music
  • Use AudioSource.PlayOneShot or AudioSource.Play to trigger sound effects in code
  • Download a sound effect for free from the internet and import it into unity. You can use Mp3s and Wav files among others.
  • Create AudioClip variables to store references to different sound effects. You can use one audiosource to play many different sounds!



Do a bonus challenge from a previous day



Add object instantiation to an NPC


Say, a cow that drops cow pies, or a creature that leaves flower petals behind it, or a squid that leaves ink clouds when it runs away, or an enemy that shoots darts at the player.

︎︎︎ Tips:
  • Just like with the weapon / item drop, you will want to somehow limit the frequency and overall number of NPCs spawned for performance.
  • Use a timer to spawn items at an interval.
  • Use a timer to destroy spawned objects after a while.

Create a plant that grows when you water it

Also consider spawning a fruit collectible when the plant has reached full growth!

︎︎︎ Tips:
  • Give the player a watering can that “shoots” drops of water
  • Use OnTriggerEnter2D to detect collisions between water and plants
  • Create a few stages of growth for the plant, and use an int to keep track of which to display.

Limit your item drop / shoot with a resource

If it’s a bow and arrow, limit the number of arrows the player can carry, and create arrow collectables. If it’s a watering can, consider adding a “water meter” that depletes a little when you use it.

Create a destructible barrier

Use the instantiated item you created in class today to bust open a cracked wall, or cut down a tree that’s blocking your path.

︎︎︎ Tips:
  • Create a separate Destructible script with an int representing health. That way you can reuse the same script for NPCS, destructable barriers, and more!
  • use OnTriggerEnter2D or OnCollisionEnter2D to deal damage
  • use Destroy() to destroy objects when they are out of health



Create destructible crates or barrels that drop items when they are broken


︎︎︎ Tips:
  • Create a separate Destructible script with an int representing health. That way you can reuse the same functionality for NPCS, destructable barriers, and more!
  • Use OnTriggerEnter2D or OnCollisionEnter2D to deal damage
  • use Destroy() to destroy objects when they are out of health
  • Create prefabs of your treasure items, and use Instantiate in an OnDestroy() function to spawn them
  • Consider using Random.Range to pick from a few different items, or have a random chance that no item drops at all
  • Consider making a separate “SpawnItemsOnDestroyed” script, so you can reuse the same functionality for NPCS, destructable barriers, and more!


Make it so some NPCs are damaged and destroyed by your instantiated objects


︎︎︎ Tips:
  • Create a separate Destructible script with an int representing health. That way you can reuse the same functionality for NPCS, destructable barriers, and more!
  • Use OnTriggerEnter2D or OnCollisionEnter2D to deal damage
  • use Destroy() to destroy objects when they are out of health

Make it so some NPCs drop collectable items when they are destroyed


︎︎︎ Tips:
  • Create prefabs of your collectables items, and use Instantiate in an OnDestroy() function to spawn them
  • Consider using Random.Range to pick from a few different items, or have a random chance that no item drops at all
  • Consider making a separate “SpawnItemsOnDestroyed” script, so you can reuse the same functionality for NPCS, destructable barriers, and more!


Create a spawner that adds new NPCs to the level periodically
Consider a spawner that keeps track of how many npcs exist (hard!)


︎︎︎ Tips:
  • Just like with the weapon / item drop, you will want to somehow limit the frequency and overall number of NPCs spawned for performance.
  • Use a timer to spawn NPCS at an interval.