Last active
August 29, 2015 14:21
-
-
Save AgrYpn1a/a7ef3b4a9e7579caf1e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// promenljiva tipa Rigidbody2D | |
Rigidbody2D myRigidbody; | |
// start metoda poziva se na startu igre, dodeljuje promenljivoj myRigidbody, Rigidbody komponentu sa "ovog" game objekta | |
void Start() { | |
myRigidbody = this.gameObject.GetComponent<Rigidbody2D>(); | |
} | |
// Mathf klasa matematickih funkcija, Abs(param) funkcija koja vraca apsolutnu vrednost | |
// proveravamo da li je brzina veca od neke kriticne brzine, recimo stavi 50, isprobaj taj bag jos par puta pa vidi pri kojoj | |
// brzini loptica nestaje pa to stavi kao critical speed | |
void FixedUpdate() { | |
if (Mathf.Abs(myRigidbody.velocity.y) > criticalSpeed) | |
StartCoroutine(ResetujuLopticu(neko vreme)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment