2020-07-19 17:19:31 -05:00
|
|
|
extends KinematicBody2D
|
|
|
|
|
|
|
|
class_name Enemy
|
|
|
|
|
|
|
|
var speed = 60
|
2020-07-20 23:24:09 -05:00
|
|
|
var gravity = 200
|
2020-07-20 14:59:31 -05:00
|
|
|
var health = 1
|
2020-07-20 23:24:09 -05:00
|
|
|
var knockback_amount = 1000
|
|
|
|
var knockback = Vector2.ZERO
|
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-20 23:24:09 -05:00
|
|
|
func get_player_position():
|
|
|
|
return Player.position
|
|
|
|
|
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-20 23:24:09 -05:00
|
|
|
func do_knockback(normal):
|
|
|
|
knockback = normal
|
2020-07-20 16:36:28 -05:00
|
|
|
|