monke
This commit is contained in:
@@ -9,6 +9,17 @@ var movement = Vector3()
|
||||
var direction = Vector3()
|
||||
var gravity_vec = Vector3()
|
||||
|
||||
onready var hurtbox = $Hurtbox/HeadCollision
|
||||
onready var hitbox = $HitBox/CollisionShape
|
||||
onready var animation_player = $AnimationPlayer
|
||||
|
||||
func _ready():
|
||||
animation_player.play("floating")
|
||||
var rng = RandomNumberGenerator.new()
|
||||
rng.randomize()
|
||||
animation_player.seek(rng.randf_range(0.0,3.0))
|
||||
animation_player.stop()
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
velocity = velocity.linear_interpolate(direction * hit_speed, hit_acceleration * delta)
|
||||
@@ -18,9 +29,22 @@ func _physics_process(delta):
|
||||
movement.z = velocity.z
|
||||
|
||||
move_and_slide(movement, Vector3.UP)
|
||||
|
||||
func get_slapped(slap_level, slap_vector):
|
||||
direction = slap_vector
|
||||
|
||||
func get_shot():
|
||||
if get_slide_count() > 0:
|
||||
var collision = get_slide_collision(0)
|
||||
if collision != null:
|
||||
direction = direction.bounce(collision.normal)
|
||||
|
||||
func get_slapped(slap_level, slap_kill, slap_vector):
|
||||
if slap_level >= slap_kill:
|
||||
animation_player.stop()
|
||||
direction = slap_vector * slap_level
|
||||
hurtbox.disabled = true
|
||||
hitbox.disabled = false
|
||||
|
||||
func get_shot(hitboxOwner):
|
||||
hitboxOwner.die()
|
||||
die()
|
||||
|
||||
func die():
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user