added piranha plant rotation + a small optimization to playing custom levels?

This commit is contained in:
JHDev2006
2025-10-01 15:15:15 +01:00
parent 95416e3639
commit 8fbfbd84bf
4 changed files with 29 additions and 5 deletions

View File

@@ -282,7 +282,8 @@ func parse_tiles() -> void:
for i in entity_layer_nodes:
if is_instance_valid(i) == false:
continue
saved_entity_layers[idx] = i.duplicate(DUPLICATE_USE_INSTANTIATION)
if load_play == false:
saved_entity_layers[idx] = i.duplicate(DUPLICATE_USE_INSTANTIATION)
if i is Player:
i.direction = 1
i.velocity = Vector2.ZERO

View File

@@ -2,6 +2,8 @@ extends Enemy
@export var player_range := 24
@export_enum("Up", "Down", "Left", "Right") var pipe_direction := 0
func _enter_tree() -> void:
$Animation.play("Hide")
@@ -13,5 +15,8 @@ func _ready() -> void:
func on_timeout() -> void:
var player = get_tree().get_first_node_in_group("Players")
if abs(player.global_position.x - global_position.x) >= player_range:
$Animation.play("Rise")
if pipe_direction < 2:
if abs(player.global_position.x - global_position.x) >= player_range:
$Animation.play("Rise")
elif (abs(player.global_position.y - global_position.y) >= player_range and abs(player.global_position.x - global_position.x) >= player_range * 2):
$Animation.play("Rise")