Game Development Reference
In-Depth Information
In this if conditional, it tests to see if the contents of the parentheses
is true. Using !invincible is a shorthand for “the opposite of the value
of invincible .” If invincible is true , then !invincible is false . If the
conditional tests false, then the subsequent code block is not executed,
which means the player character is not converted to a ragdoll.
3.
Save the script, scene, and project. Playtest your newfound invincibility!
Blizzard Zone
The first thing to address is repositioning and resizing the Blizzard game object containing the killer
particle system. Select the Blizzard game object in the Hierarchy, then in the Inspector change the
Transform position coordinates to (-10, 11.5, 117) to center it in the zone. Recall that the -10 x-offset
is to allow the player time to see and react to the approaching snowflakes (Figure 10-13 ).
Figure 10-13. Blizzard of deadly snowflakes crossing the elevated track
Still in the Inspector, scroll down to the Shape module of the Particle System component. Change
Box X to 17 to expand the particle-emitting surface to the length of the zone. The snowflakes are
now less dense, since they are adhering to the Emission module's rate of 10.
Chapter 8 provided an overview of particle systems and their modules and properties. You can go
through these properties and reset them in the Inspector to account for the new size and location
of the particle emitter. But how would you go about making this zone more difficult as the player
proceeds according to your game design? Through scripting, of course.
To make the snowflakes emit with a higher velocity the farther the player proceeds through the
zone, open the Project panel, open the Assets ➤ Scripts folder, and create a new script named
BlizzardZone. Open it in MonoDevelop and edit the code to the following:
#pragma strict
public var playerTransform : Transform;
public var rateIncrease : float = 1;
 
Search WWH ::




Custom Search