First_Person_Slapper/Scenes/Enemy.gd

27 lines
516 B
GDScript3
Raw Normal View History

2022-10-11 19:11:46 -04:00
extends KinematicBody
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):
direction = slap_vector
func get_shot():
queue_free()