forked from team-sg/hero-mark-2
38 lines
972 B
GDScript
38 lines
972 B
GDScript
extends "res://objects/enemy/enemy.gd"
|
|
|
|
export var off_time = 1.0
|
|
export var on_time = 1.0
|
|
export var active = false
|
|
|
|
onready var particles = $SteamParticles
|
|
onready var collision_shape = $Hitbox/CollisionShape2D
|
|
onready var animation_player = $AnimationPlayer
|
|
|
|
var time = 0.0
|
|
|
|
func _ready():
|
|
if !active:
|
|
particles.emitting = false
|
|
collision_shape.disabled = true
|
|
# adjust to difficulty
|
|
off_time /= Game.enemy_speed_factor
|
|
on_time /= Game.enemy_speed_factor
|
|
|
|
func _physics_process(delta):
|
|
time += delta
|
|
if active && time >= on_time:
|
|
time -= on_time
|
|
active = false
|
|
animation_player.play("turn_off")
|
|
elif !active && time >= off_time:
|
|
time -= off_time
|
|
active = true
|
|
animation_player.play("turn_on")
|
|
|
|
func switch_action():
|
|
animation_player.play("turn_off")
|
|
animation_player.connect("animation_finished", self, "_queue_free")
|
|
|
|
#stupidstupidstupidstupidarrrghhhwouldnotneedtodothisshitingodot4grumblegrumble
|
|
func _queue_free(_anim_name):
|
|
queue_free()
|