0% found this document useful (0 votes)
14 views15 pages

Lab 7 - Clicky Mouse

This document provides instructions for creating a clicky mouse game where the player scores points by clicking on targets that are tossed into the air. It involves: 1. Importing packages, adding colliders to target objects, and creating a Target script to control the targets. 2. Writing functions in the Target script to toss the targets into the air with upward force and torque. 3. Creating a Game Manager to store an object list and spawn objects with a coroutine. 4. Adding a click sensor and script to destroy targets when clicked and update the score text, while playing particle and sound effects using coroutines to delay destruction.

Uploaded by

alfikra muhammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views15 pages

Lab 7 - Clicky Mouse

This document provides instructions for creating a clicky mouse game where the player scores points by clicking on targets that are tossed into the air. It involves: 1. Importing packages, adding colliders to target objects, and creating a Target script to control the targets. 2. Writing functions in the Target script to toss the targets into the air with upward force and torque. 3. Creating a Game Manager to store an object list and spawn objects with a coroutine. 4. Adding a click sensor and script to destroy targets when clicked and update the score text, while playing particle and sound effects using coroutines to delay destruction.

Uploaded by

alfikra muhammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

LAB 7 – CLICKY MOUSE

Open Package

• Go to Assets à Import
Go Package à Custom Package.

• Choose the package


Choose provided, and click Open.

• Delete the SampleScene.


Delete
Create Targets

Add Create Drag

• Add Box Collider • Create a new script, • Drag all 4 targets into
components to target Target.cs, attach it to the Prefabs folder to
objects ( “Good 1”, all target objects. create “original
“Good 2”, “Good 3”, prefabs”, then delete
and “Bad 1”), then them from the scene.
make sure that
Colliders surround
the objects properly.
Toss Targets in the Air

In Target.cs,
In Start(),
declare the
initialize the
variables as
targetRb
shown.
Toss Targets in the Air

Create Start Test by

Create another 3 In Start(), add the Test by dragging


functions as upward force as the Prefabs into
shown. well as torque by hierarchy (Play
calling the mode).
functions that we
have just created.
Game Manager – Object List



Spawn Objects with Coroutine



Destroy the Targets with Click & Sensor



The name of your object in hierarchy
Score Text (exact spelling)





Score Text


Add Particle Explosion •


Add Sound Effects •


Add Sound Effects


Add Sound Effects Some cleaning up needs to be done.
First, for each Target, Add Component à Audio Source.
Next, we need to delay the Destroy call, or else the audio will not be heard.
Use coroutine to fix this problem.
First, create an IEnumerator method to destroy the object, then call the
coroutine when the object needs to be destroyed.
TO DO

You might also like