Compare commits
2 commits
29c30a10de
...
fc8f6ec2fc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fc8f6ec2fc | ||
![]() |
d3d63402b8 |
5 changed files with 105 additions and 27 deletions
gmtk_2024
49
gmtk_2024/objects/LevA5DE.tmp
Normal file
49
gmtk_2024/objects/LevA5DE.tmp
Normal file
|
@ -0,0 +1,49 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://n2culjgg5aji"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://cohbys634cf18" path="res://menu/main_menu/MainMenuTheme.tres" id="1_tm23e"]
|
||||
[ext_resource type="PackedScene" uid="uid://dii1q3f5dj72y" path="res://objects/CRT.tscn" id="2_d3r0j"]
|
||||
[ext_resource type="Script" path="res://scripts/level_completed_control.gd" id="3_38v2l"]
|
||||
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="4_8fqei"]
|
||||
|
||||
[node name="LevelComplete" type="MarginContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_tm23e")
|
||||
|
||||
[node name="CanvasLayer" parent="." instance=ExtResource("2_d3r0j")]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 2
|
||||
script = ExtResource("3_38v2l")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BackToMenu" type="HBoxContainer" parent="Control/VBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/BackToMenu"]
|
||||
custom_minimum_size = Vector2(8, 0)
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("4_8fqei")
|
||||
text = ">"
|
||||
|
||||
[node name="back" type="Button" parent="Control/VBoxContainer/BackToMenu"]
|
||||
layout_mode = 2
|
||||
text = "back to level menu"
|
||||
flat = true
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/BackToMenu/back" to="Control" method="_return_to_main_menu"]
|
|
@ -38,7 +38,8 @@ player_left={
|
|||
}
|
||||
player_jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
click={
|
||||
|
|
|
@ -9,32 +9,62 @@ YOU NOW HAVE ACCESS TO THE NEXT SECTION
|
|||
|
||||
var current_text = ""
|
||||
var char_index = 0
|
||||
var typing_speed = 0.05 # Normale Tippgeschwindigkeit
|
||||
var fast_typing_speed = 0.01 # Schnellere Tippgeschwindigkeit
|
||||
var is_fast_typing = false # Statusvariable für schnelleres Tippen
|
||||
|
||||
# Zum Überprüfen eines Doppelklicks
|
||||
var typing_speed = 0.05
|
||||
var fast_typing_speed = 0.0001
|
||||
var last_click_time = 0.0
|
||||
var double_click_time = 0.3 # Zeitfenster für Doppelklick in Sekunden
|
||||
var double_click_time = 0.3
|
||||
var is_typing = true
|
||||
var current_button_index = 0
|
||||
var button
|
||||
|
||||
func _ready():
|
||||
_initialize_menu()
|
||||
_start_typing()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
# Überprüfe, ob eine Taste oder Maustaste gedrückt gehalten wird
|
||||
if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("ui_accept"):
|
||||
if get_time_since_last_click() <= double_click_time:
|
||||
_show_full_text()
|
||||
else:
|
||||
is_fast_typing = true
|
||||
else:
|
||||
is_fast_typing = false
|
||||
func _initialize_menu():
|
||||
button = $VBoxContainer/BackToMenu
|
||||
_update_button_visibility()
|
||||
_blink_current_button()
|
||||
|
||||
typing_speed = fast_typing_speed if is_fast_typing else 0.05
|
||||
func _update_button_visibility():
|
||||
var hbox_container = button
|
||||
var label_node = hbox_container.get_child(0)
|
||||
if label_node != null:
|
||||
label_node.visible
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not is_typing:
|
||||
if Input.is_action_pressed("ui_accept"):
|
||||
typing_speed = fast_typing_speed
|
||||
|
||||
func _blink_current_button() -> void:
|
||||
while true:
|
||||
var hbox_container = button
|
||||
var label_node = hbox_container.get_child(0)
|
||||
if label_node != null:
|
||||
label_node.visible = true
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
if label_node != null:
|
||||
label_node.visible = false
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if is_typing:
|
||||
if event is InputEventKey and event.is_pressed():
|
||||
if get_time_since_last_click() <= double_click_time:
|
||||
_show_full_text()
|
||||
else:
|
||||
typing_speed = fast_typing_speed
|
||||
elif event is InputEventKey and not event.is_pressed():
|
||||
typing_speed = 0.05
|
||||
else:
|
||||
if event.is_action_pressed("ui_accept"):
|
||||
button.get_child(1).emit_signal("pressed")
|
||||
|
||||
func _start_typing() -> void:
|
||||
current_text = ""
|
||||
char_index = 0
|
||||
is_typing = true
|
||||
_update_text()
|
||||
|
||||
func _update_text() -> void:
|
||||
|
@ -45,6 +75,7 @@ func _update_text() -> void:
|
|||
await get_tree().create_timer(typing_speed).timeout
|
||||
_update_text()
|
||||
else:
|
||||
is_typing = false
|
||||
_show_menu_options()
|
||||
|
||||
func _show_menu_options() -> void:
|
||||
|
|
|
@ -117,7 +117,7 @@ func get_time_since_last_click() -> float:
|
|||
return time_since_last_click
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.tscn")
|
||||
get_tree().change_scene_to_file("res://levels/level_1.tscn")
|
||||
|
||||
func _on_level_select_pressed():
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.tscn")
|
||||
|
|
|
@ -24,7 +24,6 @@ var pause_menu_node = null
|
|||
func _ready():
|
||||
current_scene = get_tree().current_scene
|
||||
|
||||
# Referenz auf das übergeordnete Pausenmenü
|
||||
pause_menu_node = get_parent()
|
||||
|
||||
for hbox in $VBoxContainer/Buttons.get_children():
|
||||
|
@ -54,17 +53,15 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
typing_speed = fast_typing_speed
|
||||
elif event is InputEventKey and not event.is_pressed():
|
||||
typing_speed = 0.05
|
||||
else:
|
||||
if event.is_action_pressed("pause"):
|
||||
toggle_pause_menu()
|
||||
#else:
|
||||
#if event.is_action_pressed("pause"):
|
||||
#toggle_pause_menu()
|
||||
|
||||
# Navigation mit den Pfeiltasten
|
||||
if event.is_action_pressed("ui_down"):
|
||||
navigate_menu(1)
|
||||
elif event.is_action_pressed("ui_up"):
|
||||
navigate_menu(-1)
|
||||
|
||||
# Bestätigen mit der Leertaste oder Enter
|
||||
if event.is_action_pressed("ui_accept"):
|
||||
buttons[current_button_index].get_child(1).emit_signal("pressed")
|
||||
|
||||
|
@ -92,7 +89,7 @@ func _update_text() -> void:
|
|||
func _show_menu_options() -> void:
|
||||
for hbox in $VBoxContainer/Buttons.get_children():
|
||||
hbox.visible = true
|
||||
grab_focus() # Menü erhält den Fokus, um Eingaben zu empfangen
|
||||
grab_focus()
|
||||
|
||||
func _show_full_text() -> void:
|
||||
current_text = display_text
|
||||
|
@ -102,7 +99,7 @@ func _show_full_text() -> void:
|
|||
_show_menu_options()
|
||||
|
||||
func get_time_since_last_click() -> float:
|
||||
var current_time = Time.get_ticks_msec() / 1000.0 # Zeit in Sekunden
|
||||
var current_time = Time.get_ticks_msec() / 1000.0
|
||||
var time_since_last_click = current_time - last_click_time
|
||||
last_click_time = current_time
|
||||
return time_since_last_click
|
||||
|
@ -113,7 +110,7 @@ func toggle_pause_menu():
|
|||
else:
|
||||
pause_menu_node.visible = true
|
||||
get_tree().paused = true
|
||||
grab_focus() # Menü erhält den Fokus, um Eingaben zu empfangen
|
||||
grab_focus()
|
||||
|
||||
func _on_continue_button_pressed():
|
||||
pause_menu_node.visible = false
|
||||
|
|
Loading…
Add table
Reference in a new issue