first version of EU AI Act game
This commit is contained in:
+122
@@ -0,0 +1,122 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var label = $CanvasLayer/Panel/Label
|
||||
@onready var player = $"../Player"
|
||||
@onready var balloons = $"../Objects/Balloons"
|
||||
|
||||
var current_step = 0
|
||||
var time_start = 0.0
|
||||
var current_time_passed = 0.0
|
||||
|
||||
# Track which directions were used
|
||||
var walked = {
|
||||
"ui_left": false,
|
||||
"ui_right": false,
|
||||
"ui_up": false,
|
||||
"ui_down": false
|
||||
}
|
||||
# Track which directions were used
|
||||
var turned = {
|
||||
"cam_right": false,
|
||||
"cam_left": false
|
||||
}
|
||||
|
||||
var steps = [
|
||||
"Nutzen Sie die Pfeiltasten (oder a,s,d,w), um einmal in alle Richtungen zu laufen.
|
||||
Sie können sie bei längeren Strecken auch gedrückt halten.",
|
||||
"Mit der Leertaste können Sie springen.",
|
||||
"Durch Bewegen der Maus lässt sich die Kamera steuern. Mit [r] können Sie zwischen dem Kamera und Wurfmodus wechseln.",
|
||||
"Im Wurfmodus können Sie mit der Maus zielen und durch Klicken Bälle werfen (Sie sollten dabei ein Fadenkreuz sehen).
|
||||
Versuchen Sie, die Ballons zum platzen zu bringen.",
|
||||
"Um Objekte, wie z.B. die blauen Blöcke, aufzuheben, nutzen Sie die Taste [e] (sobald Sie nah genug davor stehen)",
|
||||
"Ablegen geht mit [q]",
|
||||
"Um mit anderen Lebewesen zu reden, drücken Sie [Enter] oder [t]."
|
||||
]
|
||||
|
||||
func _ready():
|
||||
time_start = Time.get_unix_time_from_system()
|
||||
update_label()
|
||||
$CanvasLayer/SubViewportContainer/SubViewport/helper/AnimationPlayer.play('happy')
|
||||
|
||||
|
||||
func _process(delta):
|
||||
check_time()
|
||||
match current_step:
|
||||
0:
|
||||
check_walk_directions()
|
||||
1:
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
#$"../Objects/Balloons".position.y = 6.0
|
||||
next_step()
|
||||
2:
|
||||
if Input.is_action_just_pressed("throw"):
|
||||
next_step()
|
||||
3:
|
||||
if balloons.get_child_count() < 3:
|
||||
next_step()
|
||||
4:
|
||||
if Input.is_action_just_pressed("grab") and player.grabbed_item:
|
||||
next_step()
|
||||
5:
|
||||
if Input.is_action_just_pressed("drop"):
|
||||
next_step()
|
||||
6:
|
||||
if player.dialogueActive:
|
||||
next_step()
|
||||
|
||||
|
||||
func check_walk_directions():
|
||||
for action in walked.keys():
|
||||
if Input.is_action_just_pressed(action):
|
||||
walked[action] = true
|
||||
|
||||
if walked.values().all(func(v): return v):
|
||||
$"../Objects/Bridges/walls_tutorial/walls_to_bridge".queue_free()
|
||||
$"../Objects/Chip0/block".position.y = 0.0
|
||||
$"../Objects/arrows/help1".position.y = 4.892
|
||||
next_step()
|
||||
|
||||
|
||||
func check_camera_turned():
|
||||
for action in turned.keys():
|
||||
if Input.is_action_just_pressed(action):
|
||||
turned[action] = true
|
||||
|
||||
if turned.values().all(func(v): return v):
|
||||
next_step()
|
||||
|
||||
func next_step():
|
||||
current_step += 1
|
||||
time_start = Time.get_unix_time_from_system()
|
||||
$AnimationPlayer.play('RESET')
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_color = Color('cccccc')
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_left = 5
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_right = 5
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_top = 5
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_bottom = 5
|
||||
$CanvasLayer/Panel.size.y = 150
|
||||
update_label()
|
||||
|
||||
|
||||
func update_label():
|
||||
if current_step < steps.size():
|
||||
label.text = steps[current_step]
|
||||
await get_tree().process_frame
|
||||
var text_size = label.get_minimum_size()
|
||||
$CanvasLayer/Panel.custom_minimum_size = text_size + Vector2(40, 40)
|
||||
else:
|
||||
label.text = ""
|
||||
queue_free()
|
||||
|
||||
func check_time() -> void:
|
||||
current_time_passed = Time.get_unix_time_from_system() - time_start
|
||||
if current_time_passed > 15.0:
|
||||
pulse_panel()
|
||||
|
||||
func pulse_panel() -> void:
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_color = Color('30e7f2')
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_left = 8
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_right = 8
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_top = 8
|
||||
$CanvasLayer/Panel.get_theme_stylebox('panel').border_width_bottom = 8
|
||||
$AnimationPlayer.play('pulse')
|
||||
Reference in New Issue
Block a user