Gamebridge/Coin Tutorial

From Noisebridge
Jump to navigation Jump to search

Coin Tutorial

Once you've made your first level have obstacles to avoid falling forever, it's time to add some objectives for your players to seek out.

  • Create a Coin.cs script
  • Create a World.cs script
  • Make Coin.cs a trigger that sends an AddCoin message to World.cs
  • Make World.cs increment a coin integer variable and display it OnGUI.

Make a coin object

You need an actual 3D game object to represent coins in the game.

  1. In the Hierarchy panel, click Create.
  2. Click 3D Object.
  3. Click Cylinder.

Size the cylinder to look like a coin

  1. Click the Scale tool or press the R key.
  2. Double click on the cylinder's name in the Hierarchy or type F key to focus on the cylinder, which zooms into it
  3. In the inspector panel, the scale's Y value defaults to 1. Set it to be 0.1.
  4. Now it looks like a flat, circular coin, a doubloon!

Color the coin to be golden

  • Attach the Coin.cs script to