fix: remove the whitespaces and clean up;
This commit is contained in:
@@ -8,10 +8,8 @@ func enable_secret_door():
|
|||||||
visible = true
|
visible = true
|
||||||
collision_enabled = true
|
collision_enabled = true
|
||||||
|
|
||||||
|
|
||||||
func _on_switch_switch_activated() -> void:
|
func _on_switch_switch_activated() -> void:
|
||||||
disable_secret_door()
|
disable_secret_door()
|
||||||
|
|
||||||
|
|
||||||
func _on_switch_switch_deactivated() -> void:
|
func _on_switch_switch_deactivated() -> void:
|
||||||
enable_secret_door()
|
enable_secret_door()
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
extends StaticBody2D
|
extends StaticBody2D
|
||||||
|
|
||||||
|
|
||||||
func _on_puzzle_button_pressed() -> void:
|
func _on_puzzle_button_pressed() -> void:
|
||||||
visible = false
|
visible = false
|
||||||
$CollisionShape2D.set_deferred("disabled", true)
|
$CollisionShape2D.set_deferred("disabled", true)
|
||||||
|
|
||||||
|
|
||||||
func _on_puzzle_button_unpressed() -> void:
|
func _on_puzzle_button_unpressed() -> void:
|
||||||
visible = true
|
visible = true
|
||||||
$CollisionShape2D.set_deferred("disabled", false)
|
$CollisionShape2D.set_deferred("disabled", false)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ extends StaticBody2D
|
|||||||
@export var dialogue_lines: Array[String] = ["Hello!", "Good day to you!", "Welcome!"]
|
@export var dialogue_lines: Array[String] = ["Hello!", "Good day to you!", "Welcome!"]
|
||||||
var can_interact: bool = false
|
var can_interact: bool = false
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("Interact") and can_interact:
|
if Input.is_action_just_pressed("Interact") and can_interact:
|
||||||
$CanvasLayer/DialogLabel.text = dialogue_lines[randi_range(0, 2)]
|
$CanvasLayer/DialogLabel.text = dialogue_lines[randi_range(0, 2)]
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class_name Player
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
update_scrolls()
|
||||||
var damage: float = 2
|
var damage: float = 2
|
||||||
if SceneManager.player_next_scene_spawn_pos != Vector2(0, 0):
|
if SceneManager.player_next_scene_spawn_pos != Vector2(0, 0):
|
||||||
position = SceneManager.player_next_scene_spawn_pos
|
position = SceneManager.player_next_scene_spawn_pos
|
||||||
@@ -17,6 +18,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
move_player()
|
move_player()
|
||||||
push_blocks()
|
push_blocks()
|
||||||
update_scrolls()
|
update_scrolls()
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
func move_player():
|
func move_player():
|
||||||
var move_vector: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
var move_vector: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||||
@@ -45,8 +47,6 @@ func push_blocks():
|
|||||||
if collisision_node.is_in_group("pushable"):
|
if collisision_node.is_in_group("pushable"):
|
||||||
var collision_normal: Vector2 = collision.get_normal()
|
var collision_normal: Vector2 = collision.get_normal()
|
||||||
collisision_node.apply_central_force(-collision_normal * push_strength)
|
collisision_node.apply_central_force(-collision_normal * push_strength)
|
||||||
|
|
||||||
move_and_slide()
|
|
||||||
|
|
||||||
func update_scrolls():
|
func update_scrolls():
|
||||||
$CanvasLayer/Panel/Label.text = str(SceneManager.opened_chests.size())
|
$CanvasLayer/Panel/Label.text = str(SceneManager.opened_chests.size())
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ func _on_body_entered(body: Node2D) -> void:
|
|||||||
$AnimatedSprite2D.play("pressed")
|
$AnimatedSprite2D.play("pressed")
|
||||||
pressed.emit()
|
pressed.emit()
|
||||||
|
|
||||||
|
|
||||||
func _on_body_exited(body: Node2D) -> void:
|
func _on_body_exited(body: Node2D) -> void:
|
||||||
if is_single_use:
|
if is_single_use:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -2,23 +2,18 @@ extends Area2D
|
|||||||
@export var next_scene: String
|
@export var next_scene: String
|
||||||
@export var player_spawn_pos: Vector2
|
@export var player_spawn_pos: Vector2
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body: Player) -> void:
|
func _on_body_entered(body: Player) -> void:
|
||||||
print("body entered!")
|
print("body entered!")
|
||||||
SceneManager.player_next_scene_spawn_pos = player_spawn_pos
|
SceneManager.player_next_scene_spawn_pos = player_spawn_pos
|
||||||
get_tree().change_scene_to_file.call_deferred(next_scene)
|
get_tree().change_scene_to_file.call_deferred(next_scene)
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
func _on_body_exited(body: Node2D) -> void:
|
func _on_body_exited(body: Node2D) -> void:
|
||||||
print("player left!")
|
print("player left!")
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|||||||
Reference in New Issue
Block a user