34 lines
1.1 KiB
GDScript3
34 lines
1.1 KiB
GDScript3
|
|
extends Node
|
||
|
|
## Prüft die Schleife Ortsbild → Gebiet → Ortsbild ohne Fenster.
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
var ortsbild: Node = load("res://scenes/world/ortsbild.tscn").instantiate()
|
||
|
|
add_child(ortsbild)
|
||
|
|
await get_tree().process_frame
|
||
|
|
var getroffen := {"ziel": ""}
|
||
|
|
ortsbild.ziel_gewaehlt.connect(func(z: String) -> void: getroffen["ziel"] = z)
|
||
|
|
ortsbild._auf_ziel({"name": "Marktplatz", "ziel": "garana"})
|
||
|
|
print("Hotspot meldet: ", getroffen["ziel"])
|
||
|
|
ortsbild.queue_free()
|
||
|
|
|
||
|
|
var stadt: Node = load("res://scenes/world/stadt.tscn").instantiate()
|
||
|
|
stadt.set("gemalt", true)
|
||
|
|
add_child(stadt)
|
||
|
|
await get_tree().process_frame
|
||
|
|
var zurueck := {"nein": false}
|
||
|
|
stadt.zurueck.connect(func() -> void: zurueck["nein"] = true)
|
||
|
|
|
||
|
|
print("Start: ", stadt._spieler_kachel, " begehbar? ", stadt._begehbar(4, 8))
|
||
|
|
stadt._spieler_kachel = Vector2i(4, 7)
|
||
|
|
_taste(KEY_DOWN)
|
||
|
|
await get_tree().process_frame
|
||
|
|
print("nach unten: ", stadt._spieler_kachel, " | zurück ausgelöst: ", zurueck["nein"])
|
||
|
|
get_tree().quit()
|
||
|
|
|
||
|
|
func _taste(code: int) -> void:
|
||
|
|
var ev := InputEventKey.new()
|
||
|
|
ev.physical_keycode = code
|
||
|
|
ev.keycode = code
|
||
|
|
ev.pressed = true
|
||
|
|
Input.parse_input_event(ev)
|