26 lines
569 B
GDScript
26 lines
569 B
GDScript
extends KinematicBody
|
|
|
|
onready var animation_player = $AnimationPlayer
|
|
|
|
var hit_acceleration = 10
|
|
var hit_speed = 100
|
|
|
|
var velocity = Vector3()
|
|
var movement = Vector3()
|
|
var direction = Vector3()
|
|
var gravity_vec = Vector3()
|
|
|
|
func _physics_process(delta):
|
|
|
|
velocity = velocity.linear_interpolate(direction * hit_speed, hit_acceleration * delta)
|
|
|
|
movement.x = velocity.x
|
|
movement.y = velocity.y
|
|
movement.z = velocity.z
|
|
|
|
move_and_slide(movement, Vector3.UP)
|
|
|
|
func get_slapped(slap_level, slap_vector):
|
|
animation_player.play("head_wobble")
|
|
direction = slap_vector
|