mantain mask, purple attack, star enemy
This commit is contained in:
parent
66ecb04bd1
commit
e32ed2f53a
10 changed files with 213 additions and 18 deletions
12
scripts/heart_enemy.gd
Normal file
12
scripts/heart_enemy.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends Enemy
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $Anim
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
queue_redraw()
|
||||
|
||||
func _draw():
|
||||
if current_charge > 0 and target_node:
|
||||
var color = Color.RED.lerp(Color.WHITE, current_charge / attack_charge_time)
|
||||
draw_dashed_line(Vector2.ZERO, to_local(target_node.global_position), color, 1, 5)
|
||||
1
scripts/heart_enemy.gd.uid
Normal file
1
scripts/heart_enemy.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bprbgsk73wmb8
|
||||
|
|
@ -11,6 +11,11 @@ func _ready():
|
|||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
func change_scene(target_path: PackedScene, is_error: bool = false):
|
||||
var player : Player= get_tree().get_first_node_in_group("player")
|
||||
var player_mask : MaskData = null
|
||||
if player:
|
||||
player_mask = player.current_mask_data
|
||||
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
if is_error:
|
||||
|
|
@ -25,10 +30,11 @@ func change_scene(target_path: PackedScene, is_error: bool = false):
|
|||
var log_file = "res://hex.txt" if is_error else "res://log.txt"
|
||||
display_log_file(log_file)
|
||||
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
var error = get_tree().change_scene_to_packed(target_path)
|
||||
if error != OK:
|
||||
push_error("Failed to load scene")
|
||||
await get_tree().scene_changed
|
||||
|
||||
log_display.visible = false
|
||||
log_display.text = ""
|
||||
|
|
@ -37,22 +43,27 @@ func change_scene(target_path: PackedScene, is_error: bool = false):
|
|||
tween_out.tween_property(rect, "modulate:a", 0.0, 0.5)
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
player = get_tree().get_first_node_in_group("player")
|
||||
if player and player_mask:
|
||||
player.equip_mask(player_mask)
|
||||
|
||||
func display_log_file(file_path: String):
|
||||
if not FileAccess.file_exists(file_path):
|
||||
log_display.add_text("ERROR: " + file_path + " not found in build.\n")
|
||||
log_display.add_text(file_path + " not found\n")
|
||||
return
|
||||
|
||||
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||
if not file:
|
||||
log_display.add_text("ERROR: Could not open file.\n")
|
||||
log_display.add_text("cant open file\n")
|
||||
return
|
||||
|
||||
while not file.eof_reached():
|
||||
var line = file.get_line()
|
||||
if line.strip_edges() == "": continue
|
||||
|
||||
log_display.add_text(line + "\n")
|
||||
log_display.scroll_to_line(log_display.get_line_count())
|
||||
for i in range(randi() % 4):
|
||||
var line = file.get_line()
|
||||
if line.strip_edges() == "": continue
|
||||
|
||||
log_display.add_text(line + "\n")
|
||||
log_display.scroll_to_line(log_display.get_line_count())
|
||||
|
||||
var delay = 0#randf_range(0.0001, 0.00015)
|
||||
#if randf() > 0.95:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
extends Enemy
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $Anim
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
queue_redraw()
|
||||
|
|
@ -8,3 +10,10 @@ func _draw():
|
|||
if current_charge > 0 and target_node:
|
||||
var color = Color.RED.lerp(Color.WHITE, current_charge / attack_charge_time)
|
||||
draw_dashed_line(Vector2.ZERO, to_local(target_node.global_position), color, 1, 5)
|
||||
|
||||
|
||||
func _sprite_anim():
|
||||
if current_charge > 0.1:
|
||||
sprite.play("attack")
|
||||
else:
|
||||
sprite.play("default")
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ func mask_ready():
|
|||
star.from_player = from_player
|
||||
star.target_position = target_position
|
||||
if not from_player:
|
||||
star.modulate = Color.BLACK
|
||||
star.modulate = Color("#8888ff")
|
||||
get_tree().current_scene.add_child(star)
|
||||
star.mask_ready()
|
||||
await get_tree().create_timer(0.05).timeout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue