-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source code from workshop 2017-03-23
- Loading branch information
1 parent
2818c0f
commit 3770f1b
Showing
25 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class Collide : MonoBehaviour { | ||
|
||
public int lives; | ||
|
||
void OnTriggerEnter2D(Collider2D other){ | ||
if(other.transform.tag == "Asteroid"){ | ||
if (lives > 0) { | ||
lives--; | ||
Debug.Log (lives); | ||
} | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class RocketCollide : MonoBehaviour { | ||
|
||
void OnTriggerEnter2D(Collider2D other){ | ||
if (other.transform.tag == "Asteroid") { | ||
Destroy (other.gameObject); | ||
Destroy (this.gameObject); | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class Shooting : MonoBehaviour { | ||
|
||
public GameObject rocket; | ||
public float timer; | ||
float timeLeft=0; | ||
public Transform startRocket; | ||
public Transform player; | ||
|
||
|
||
|
||
// Update is called once per frame | ||
void FixedUpdate () { | ||
if(Input.GetKey(KeyCode.Space)) | ||
{ | ||
if (timeLeft > timer) { | ||
GameObject rocketShot = Instantiate (rocket,new Vector3(startRocket.position.x,startRocket.position.y,startRocket.position.z),Quaternion.identity); | ||
rocketShot.transform.rotation = player.rotation; | ||
rocketShot.GetComponent<Rigidbody2D> ().AddForce ((startRocket.position-player.position)*5f, ForceMode2D.Impulse); | ||
timeLeft = 0; | ||
} else { | ||
timeLeft += Time.deltaTime; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.