Pick up hearts

This commit is contained in:
jventalon 2015-11-19 22:09:05 -05:00
parent 222f6e6d37
commit a904cf25ab
3 changed files with 13 additions and 4 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 304af85f492026f499d09ceb6768bd22 guid: f0e4eaefb315ab44d801e3e38218f47c
timeCreated: 1446164889 timeCreated: 1447952927
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
userData: userData:

View File

@ -17,8 +17,8 @@ public class Health : MonoBehaviour
void Start () void Start ()
{ {
spaceX = 2.3f; spaceX = 1.2f;
spaceY = 2.3f; spaceY = 1.2f;
AddHearts (startingHealth); AddHearts (startingHealth);
} }
@ -69,4 +69,13 @@ public class Health : MonoBehaviour
LoseHearts(1); LoseHearts(1);
} }
} }
void OnTriggerEnter2D(Collider2D other)
{
if( other.gameObject.tag == "HeartPickUp" )
{
AddHearts(1);
Destroy (other.gameObject);
}
}
} }