Skip to content

Commit

Permalink
Source code from workshop 2017-03-23
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Mar 31, 2017
1 parent 2818c0f commit 3770f1b
Show file tree
Hide file tree
Showing 25 changed files with 124 additions and 1 deletion.
Binary file modified Assets/ASD.unity
Binary file not shown.
18 changes: 18 additions & 0 deletions Assets/Collide.cs
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);
}
}
}

}
12 changes: 12 additions & 0 deletions Assets/Collide.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Assets/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ public class Controller : MonoBehaviour {
public Rigidbody2D playerPhysics;
public Transform playerUp;


public int lives;


// Use this for initialization
void Start () {
//playerPhysics=player.GetComponent<Rigidbody2D>();
Expand Down
Binary file added Assets/Rocket.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Rocket.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Assets/RocketCollide.cs
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);
}

}
}
12 changes: 12 additions & 0 deletions Assets/RocketCollide.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Assets/Shooting.cs
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;
}
}
}
}
12 changes: 12 additions & 0 deletions Assets/Shooting.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion Assets/spaceShooter2_spritesheet.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ProjectSettings/AudioManager.asset
Binary file not shown.
Binary file modified ProjectSettings/ClusterInputManager.asset
Binary file not shown.
Binary file modified ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file modified ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/EditorSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/InputManager.asset
Binary file not shown.
Binary file modified ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file modified ProjectSettings/NetworkManager.asset
Binary file not shown.
Binary file modified ProjectSettings/Physics2DSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/QualitySettings.asset
Binary file not shown.
Binary file modified ProjectSettings/TagManager.asset
Binary file not shown.
Binary file modified ProjectSettings/TimeManager.asset
Binary file not shown.
Binary file modified ProjectSettings/UnityConnectSettings.asset
Binary file not shown.

0 comments on commit 3770f1b

Please sign in to comment.