added basic enemy collision

still need to figure out how to make the jumping on heads work, but we need a jump for that lol
This commit is contained in:
slevy14 2023-04-26 16:05:43 -07:00
parent 6fe26462cf
commit d6128d10ef
2 changed files with 9 additions and 2 deletions

View File

@ -44,7 +44,7 @@ GameObject:
- component: {fileID: 6465130401096595230}
m_Layer: 0
m_Name: CaveOctopus
m_TagString: Untagged
m_TagString: Enemy
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -63,7 +63,7 @@ Transform:
m_Children:
- {fileID: 7108139142192227224}
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!212 &4957706768026546484
SpriteRenderer:

View File

@ -166,4 +166,11 @@ public class PlayerBehavior : MonoBehaviour
grappleSurface = null;
}
}
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.tag == "Enemy") {
this.stateController.SetDeathCanvasActive(true);
Destroy(this.gameObject);
}
}
}