Browse Source

fixed level2

fixed respawn
master
Joshua Reason 9 years ago
parent
commit
fd41d1e870
10 changed files with 47 additions and 6 deletions
  1. +15
    -0
      playable/Assets/FailBox.cs
  2. +8
    -0
      playable/Assets/FailBox.cs.meta
  3. BIN
      playable/Assets/Music/Guajiras.mp3.mp3
  4. BIN
      playable/Assets/Prefabs/GameStuff.prefab
  5. +4
    -0
      playable/Assets/Prefabs/GameStuff.prefab.meta
  6. BIN
      playable/Assets/Scenes/Level1.unity
  7. BIN
      playable/Assets/Scenes/Level2.unity
  8. +4
    -0
      playable/Assets/Scenes/Level2.unity.meta
  9. +16
    -6
      playable/Assets/Scripts/playerController.cs
  10. BIN
      playable/ProjectSettings/TagManager.asset

+ 15
- 0
playable/Assets/FailBox.cs View File

@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;
public class FailBox : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}

+ 8
- 0
playable/Assets/FailBox.cs.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: efc7071f62183a94ca17971a2faab6ad
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

BIN
playable/Assets/Music/Guajiras.mp3.mp3 View File


BIN
playable/Assets/Prefabs/GameStuff.prefab View File


+ 4
- 0
playable/Assets/Prefabs/GameStuff.prefab.meta View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 1060187b3c8326e48bd0e3d0661c97a5
NativeFormatImporter:
userData:

BIN
playable/Assets/Scenes/Level1.unity View File


BIN
playable/Assets/Scenes/Level2.unity View File


+ 4
- 0
playable/Assets/Scenes/Level2.unity.meta View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 9f7e241f4fb0d2a4aaee7d97bb91f549
DefaultImporter:
userData:

+ 16
- 6
playable/Assets/Scripts/playerController.cs View File

@ -30,6 +30,7 @@ public class playerController : MonoBehaviour {
public float dashDistance; public float dashDistance;
public float dashTime; public float dashTime;
public float dashWait; public float dashWait;
public float minY;
private float displayedHealth = 3; //currently displayed health private float displayedHealth = 3; //currently displayed health
@ -47,7 +48,7 @@ public class playerController : MonoBehaviour {
private float lastDash = 0.0f; private float lastDash = 0.0f;
private bool stopDash = false; private bool stopDash = false;
public float deathTimer = 3.0f; public float deathTimer = 3.0f;
bool droppedCandy = false;
@ -68,8 +69,8 @@ public class playerController : MonoBehaviour {
death (); death ();
applyPlayerDirection (Input.GetAxisRaw (HorizontalBtn)); applyPlayerDirection (Input.GetAxisRaw (HorizontalBtn));
damage (); damage ();
if (transform.position.y < -3)
health = 0;
//if (transform.position.y < minY)
// health = 0;
if (score >= 10) { if (score >= 10) {
gameOverDisplay.enabled = true; gameOverDisplay.enabled = true;
@ -167,19 +168,24 @@ public class playerController : MonoBehaviour {
if (deathTimer > 0) if (deathTimer > 0)
{ {
deathTimer -=Time.deltaTime; deathTimer -=Time.deltaTime;
if (!droppedCandy){
Instantiate (newCandy, transform.position + Vector3.up, transform.rotation);
droppedCandy = true;
}
transform.position = new Vector3 (0,-50,0);
//gameObject.active = false; //gameObject.active = false;
if(deathTimer <=0) if(deathTimer <=0)
{ {
//gameObject.active = true; //gameObject.active = true;
transform.position = new Vector3 (0,30,0);
Instantiate (newCandy, transform.position + Vector3.up, transform.rotation);
Vector3 spawnPos = new Vector3 (Random.Range (-20.0f, 20.0f), 15.0f, 0); //picks random position Vector3 spawnPos = new Vector3 (Random.Range (-20.0f, 20.0f), 15.0f, 0); //picks random position
health = 3; //resets life health = 3; //resets life
transform.position = spawnPos; //changes position transform.position = spawnPos; //changes position
rigidbody2D.velocity = Vector2.zero; rigidbody2D.velocity = Vector2.zero;
deathTimer = deathTimer + 3.02f; deathTimer = deathTimer + 3.02f;
droppedCandy = false;
} }
}//end if }//end if
@ -291,6 +297,10 @@ public class playerController : MonoBehaviour {
stopDash = true; stopDash = true;
} }
if (col.collider.tag == "failBox") {
health = 0;
}
} }
void OnTriggerEnter2D(Collider2D trig) void OnTriggerEnter2D(Collider2D trig)

BIN
playable/ProjectSettings/TagManager.asset View File


Loading…
Cancel
Save