Game Development �With Unity
Maris Stella �Robotics & Programming Club�2020
Review
Today
CHECKPOINT - Assessment
C# Scripting
C# Building
C# Basics
Unity C# - Useful Basic Classes
Scripting Example: Change SpawnPoint
You can choose whether to render a sprite, or to make this an invisible collision zone.
Scripting Example: Change SpawnPoint
Scripting Example: Change SpawnPoint
�void onTriggerEnter2D(Collider2D other) �{
// Change the SpawnPoint’s position to this position, � // Whenever a Player collides with this...
}
Scripting Example: Change SpawnPoint
�public GameObject spawnPoint;
void onTriggerEnter2D(Collider2D other) �{
// Change the SpawnPoint’s position, � // Whenever a Player collides with this...
}
Scripting Example: Change SpawnPoint
public GameObject spawnPoint;
void onTriggerEnter2D(Collider2D other) �{
// Change the SpawnPoint’s position, � // Whenever a Player collides with this…� spawnPoint.transform.position = transform.position;
}
Scripting Example: Change SpawnPoint
public GameObject spawnPoint;
void onTriggerEnter2D(Collider2D other) �{� // Change the SpawnPoint’s position, � // Whenever a Player collides with this…� If (other.name == “Player”) {� spawnPoint.transform.position = transform.position;� }�}
Scripting Example: Change SpawnPoint