the-crypt/ai/Enemy.gd

21 lines
319 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-20 14:59:31 -05:00
var health = 1
2020-07-19 17:19:31 -05:00
const UP = Vector2(0, -1)
var velocity = Vector2()
2020-07-20 00:06:53 -05:00
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
if is_on_wall() and is_on_floor():
velocity.y = -150
2020-07-20 16:36:28 -05:00