28 lines
475 B
GDScript3
28 lines
475 B
GDScript3
|
extends "res://objects/characters/character.gd"
|
||
|
|
||
|
export var speed: int = 50
|
||
|
export var reverse_direction: bool = false
|
||
|
const DAMAGE = 5
|
||
|
|
||
|
func _ready():
|
||
|
if reverse_direction:
|
||
|
motion.x = -speed
|
||
|
else:
|
||
|
motion.x = speed
|
||
|
|
||
|
func _process(delta):
|
||
|
if motion != null:
|
||
|
if motion.x > 0:
|
||
|
$Sprite.flip_h = true
|
||
|
elif motion.x < 0:
|
||
|
$Sprite.flip_h = false
|
||
|
if health <= 0:
|
||
|
_die()
|
||
|
|
||
|
func stomped_on_head():
|
||
|
pass
|
||
|
|
||
|
func _die():
|
||
|
motion = null
|
||
|
$Collision.disabled = true
|