the-crypt/ai/Enemy.gd

20 lines
318 B
GDScript3
Raw Normal View History

2020-07-19 17:19:31 -05:00
extends KinematicBody2D
class_name Enemy
var speed = 60
2020-07-19 23:45:39 -05:00
var gravity = 500
2020-07-19 17:19:31 -05:00
var health = 5
const UP = Vector2(0, -1)
var velocity = Vector2()
2020-07-19 19:57:34 -05:00
func get_type():
2020-07-19 23:45:39 -05:00
return "enemy"
2020-07-19 17:19:31 -05:00
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
2020-07-19 17:19:31 -05:00
if is_on_wall() and is_on_floor():
velocity.y = -150