minor menu changes
This commit is contained in:
parent
349de7441e
commit
118d6bc7ea
4 changed files with 105 additions and 46 deletions
|
@ -10,17 +10,28 @@ Music: TBN
|
|||
|
||||
var current_text = ""
|
||||
var char_index = 0
|
||||
var typing_speed = 0.05
|
||||
var fast_typing_speed = 0.005
|
||||
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 last_click_time = 0.0
|
||||
var double_click_time = 0.3 # Zeitfenster für Doppelklick in Sekunden
|
||||
|
||||
func _ready():
|
||||
_start_typing()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("click"):
|
||||
typing_speed = fast_typing_speed
|
||||
# Ü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:
|
||||
typing_speed = 0.05
|
||||
is_fast_typing = false
|
||||
|
||||
typing_speed = fast_typing_speed if is_fast_typing else 0.05
|
||||
|
||||
func _start_typing() -> void:
|
||||
current_text = ""
|
||||
|
@ -30,13 +41,27 @@ func _start_typing() -> void:
|
|||
func _update_text() -> void:
|
||||
if char_index < credits_text.length():
|
||||
current_text += credits_text[char_index]
|
||||
$Label.text = current_text
|
||||
$VBoxContainer/Label.text = current_text
|
||||
char_index += 1
|
||||
await get_tree().create_timer(typing_speed).timeout
|
||||
_update_text()
|
||||
else:
|
||||
_return_to_main_menu()
|
||||
_show_menu_options()
|
||||
|
||||
func _show_menu_options() -> void:
|
||||
$VBoxContainer/BackToMenu.visible = true
|
||||
|
||||
func _return_to_main_menu() -> void:
|
||||
await get_tree().create_timer(2).timeout
|
||||
get_tree().change_scene_to_file("res://menu/main_menu/MainMenu.tscn")
|
||||
|
||||
func _show_full_text() -> void:
|
||||
current_text = credits_text
|
||||
$VBoxContainer/Label.text = current_text
|
||||
char_index = credits_text.length()
|
||||
_show_menu_options()
|
||||
|
||||
func get_time_since_last_click() -> float:
|
||||
var current_time = Time.get_ticks_msec() / 1000.0 # Zeit in Sekunden
|
||||
var time_since_last_click = current_time - last_click_time
|
||||
last_click_time = current_time
|
||||
return time_since_last_click
|
||||
|
|
|
@ -3,38 +3,40 @@ extends Control
|
|||
var display_text = """
|
||||
SYSTEM INITIALIZATION...
|
||||
---------------------------------------
|
||||
PLACEHOLDER BOOT SEQUENCE
|
||||
PLACEHOLDER GAME NAME BOOT SEQUENCE
|
||||
COPYRIGHT PLACEHOLDER
|
||||
|
||||
> CPU:
|
||||
> MEMORY:
|
||||
> STORAGE:
|
||||
> GPU:
|
||||
MADE FOR GMTK GAME JAM 2024
|
||||
|
||||
>> WARNING:
|
||||
>> RECOMMENDED ACTION:
|
||||
|
||||
SYSTEM READY.
|
||||
PRESS START TO INITIATE.
|
||||
PRESS START TO GET ACCESS.
|
||||
|
||||
"""
|
||||
|
||||
var current_text = ""
|
||||
var char_index = 0
|
||||
var typing_speed = 0.05
|
||||
var fast_typing_speed = 0.005
|
||||
var fast_typing_speed = 0.0001
|
||||
var last_click_time = 0.0
|
||||
var double_click_time = 0.3
|
||||
|
||||
func _ready():
|
||||
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||
for hbox in $VBoxContainer/Buttons.get_children():
|
||||
hbox.visible = false
|
||||
|
||||
_start_typing()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_accept") or event is InputEventMouseButton:
|
||||
if get_time_since_last_click() <= double_click_time:
|
||||
_show_full_text()
|
||||
else:
|
||||
typing_speed = fast_typing_speed
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("click"):
|
||||
typing_speed = fast_typing_speed
|
||||
else:
|
||||
typing_speed = 0.05
|
||||
typing_speed = 0.05 # Zurück zur normalen Geschwindigkeit
|
||||
|
||||
func _start_typing() -> void:
|
||||
current_text = ""
|
||||
|
@ -52,9 +54,20 @@ func _update_text() -> void:
|
|||
_show_menu_options()
|
||||
|
||||
func _show_menu_options() -> void:
|
||||
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||
for hbox in $VBoxContainer/Buttons.get_children():
|
||||
hbox.visible = true
|
||||
|
||||
func _show_full_text() -> void:
|
||||
current_text = display_text
|
||||
$VBoxContainer/VBoxContainer2/Label.text = current_text
|
||||
char_index = display_text.length()
|
||||
_show_menu_options()
|
||||
|
||||
func get_time_since_last_click() -> float:
|
||||
var current_time = Time.get_ticks_msec() / 1000.0 # Zeit in Sekunden
|
||||
var time_since_last_click = current_time - last_click_time
|
||||
last_click_time = current_time
|
||||
return time_since_last_click
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.tscn")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue