mirror of
https://github.com/kodzukye/scrap-signal.git
synced 2026-04-27 04:17:35 +00:00
- Add atelier tilemap (14x14 tiles) with dark atmosphere - Add Journal D-891 interactable with Matteo Corda narrative - Add pushable frozen robot (reuses PushableBox logic) - Add PassageTrigger to reveal hidden path via TileMapLayer - Add RepairStation for SCRAP-09 self-repair mini-game - Add scrap09 puzzle in RepairMinigame with valid connections - Add door to cour unlocked by scrap09_repaired flag
28 lines
709 B
GDScript
28 lines
709 B
GDScript
class_name PushableBox
|
|
extends CharacterBody2D
|
|
|
|
@onready var _area := $DetectionArea
|
|
var _hud : HUD
|
|
|
|
func _ready() -> void:
|
|
add_to_group("pushable")
|
|
_hud = get_tree().get_first_node_in_group("hud")
|
|
_area.body_entered.connect(_on_body_entered)
|
|
_area.body_exited.connect(_on_body_exited)
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body.is_in_group("player"):
|
|
_hud.show_prompt("Pousser")
|
|
|
|
func _on_body_exited(body: Node2D) -> void:
|
|
if body.is_in_group("player"):
|
|
_hud.hide_prompt()
|
|
|
|
func try_push(direction: Vector2, tile_size: float) -> bool:
|
|
var motion := direction * tile_size
|
|
var collision := move_and_collide(motion)
|
|
if collision:
|
|
move_and_collide(-motion)
|
|
return false
|
|
return true
|