2022-07-17 14:24:15 +02:00
|
|
|
extends "res://objects/characters/character.gd"
|
|
|
|
|
|
|
|
export var speed: int = 50
|
|
|
|
export var reverse_direction: bool = false
|
2022-07-19 18:11:23 +02:00
|
|
|
export var damage : int = 5
|
2022-07-17 14:24:15 +02:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
if reverse_direction:
|
2022-07-18 03:28:10 +02:00
|
|
|
velocity.x = -speed
|
2022-07-17 14:24:15 +02:00
|
|
|
else:
|
2022-07-18 03:28:10 +02:00
|
|
|
velocity.x = speed
|
2022-07-17 14:24:15 +02:00
|
|
|
|
2022-07-27 12:51:26 +02:00
|
|
|
"""
|
2022-07-17 14:24:15 +02:00
|
|
|
func _process(delta):
|
2022-07-18 03:28:10 +02:00
|
|
|
if velocity != null:
|
|
|
|
if velocity.x > 0:
|
2022-07-17 14:24:15 +02:00
|
|
|
$Sprite.flip_h = true
|
2022-07-18 03:28:10 +02:00
|
|
|
elif velocity.x < 0:
|
2022-07-17 14:24:15 +02:00
|
|
|
$Sprite.flip_h = false
|
2022-07-19 18:11:23 +02:00
|
|
|
if health <= 0 and $Collision.disabled == false:
|
|
|
|
velocity = null
|
|
|
|
$Collision.disabled = true
|
2022-07-17 14:24:15 +02:00
|
|
|
_die()
|
2022-07-27 12:51:26 +02:00
|
|
|
"""
|
2022-07-17 14:24:15 +02:00
|
|
|
|
|
|
|
func stomped_on_head():
|
|
|
|
pass
|
|
|
|
|
|
|
|
func _die():
|
2022-07-19 18:11:23 +02:00
|
|
|
pass
|