Godot 4.6 exploration game with player movement, step-rotation camera rig, and POI interaction system (explore/rest/close menu). main.tscn is a test scene with placeholder props; debug/ holds unwired terrain prototypes (voxel river, procedural island mesh, cross-shaped hub
60 lines
1.5 KiB
GDScript
Executable File
60 lines
1.5 KiB
GDScript
Executable File
extends Node
|
|
|
|
signal interaction_opened
|
|
signal interaction_closed
|
|
|
|
var active: bool = false
|
|
var current_poi: Node = null
|
|
|
|
func open_poi(poi: Node) -> void:
|
|
active = true
|
|
current_poi = poi
|
|
InteractionUI.show_menu(poi.poi_name, _get_main_options())
|
|
|
|
func _get_main_options() -> Array:
|
|
return [
|
|
{ "label": "Erkunden", "action": "explore" },
|
|
{ "label": "Ausruhen", "action": "rest" },
|
|
{ "label": "Beenden", "action": "close" },
|
|
]
|
|
|
|
func handle_selection(action: String) -> void:
|
|
match action:
|
|
"explore":
|
|
InteractionUI.show_menu("Erkunden", _get_explore_options())
|
|
"rest":
|
|
InteractionUI.show_text("Du rastest eine Weile...\nDu fühlst dich erholt.")
|
|
"close":
|
|
close()
|
|
|
|
func handle_explore(action: String) -> void:
|
|
match action:
|
|
"track_follow":
|
|
var success = randf() > 0.5
|
|
if success:
|
|
InteractionUI.show_text("Du folgst den Spuren...\nEine seltene Tierbeobachtung!")
|
|
else:
|
|
InteractionUI.show_text("Du folgst den Spuren...\nDas Tier ist verschwunden.")
|
|
"track_leave":
|
|
close()
|
|
|
|
func _get_explore_options() -> Array:
|
|
# Zufälliges Ereignis beim Erkunden
|
|
var roll = randf()
|
|
if roll < 0.5:
|
|
InteractionUI.show_text("Du findest Tierspuren!")
|
|
return [
|
|
{ "label": "Tier verfolgen", "action": "track_follow" },
|
|
{ "label": "In Ruhe lassen", "action": "track_leave" },
|
|
]
|
|
else:
|
|
InteractionUI.show_text("Nichts Besonderes zu finden.")
|
|
return [
|
|
{ "label": "Zurück", "action": "close" },
|
|
]
|
|
|
|
func close() -> void:
|
|
active = false
|
|
current_poi = null
|
|
InteractionUI.hide_menu()
|