Basic launch
This commit is contained in:
16
Scripts/HitBox.gd
Normal file
16
Scripts/HitBox.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
class_name HitBox
|
||||
extends Area
|
||||
|
||||
enum HitboxType{
|
||||
Unassigned,
|
||||
Slap,
|
||||
Projectile,
|
||||
}
|
||||
|
||||
export var hitbox_type = HitboxType.Unassigned
|
||||
var slap_level = 0
|
||||
var slap_vector = Vector3()
|
||||
|
||||
func _init():
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
20
Scripts/HurtBox.gd
Normal file
20
Scripts/HurtBox.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
class_name HurtBox
|
||||
extends Area
|
||||
|
||||
func _init():
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
func _ready():
|
||||
connect("area_entered",self,"_on_area_entered")
|
||||
|
||||
func _on_area_entered(hitbox: HitBox):
|
||||
if hitbox == null:
|
||||
return
|
||||
if hitbox.hitbox_type == hitbox.HitboxType.Unassigned:
|
||||
return
|
||||
|
||||
if hitbox.hitbox_type == hitbox.HitboxType.Slap and owner.has_method("get_slapped"):
|
||||
owner.get_slapped(hitbox.slap_level, hitbox.slap_vector)
|
||||
elif hitbox.hitbox_type == hitbox.HitboxType.Projectile and owner.has_method("get_shot"):
|
||||
owner.get_shot()
|
Reference in New Issue
Block a user