minor menu changes
This commit is contained in:
parent
349de7441e
commit
118d6bc7ea
4 changed files with 105 additions and 46 deletions
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cut2xjnvh8i58"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cut2xjnvh8i58"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://cohbys634cf18" path="res://menu/main_menu/MainMenuTheme.tres" id="1_tmf11"]
|
||||
[ext_resource type="Script" path="res://scripts/menu_credit_control.gd" id="2_ogwi7"]
|
||||
[ext_resource type="PackedScene" uid="uid://dii1q3f5dj72y" path="res://objects/CRT.tscn" id="3_rybt6"]
|
||||
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="4_pv7fe"]
|
||||
|
||||
[node name="CreditScene" type="MarginContainer"]
|
||||
anchors_preset = 15
|
||||
|
@ -12,17 +13,37 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
theme = ExtResource("1_tmf11")
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_ogwi7")
|
||||
|
||||
[node name="Label" type="Label" parent="Control"]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 13.0
|
||||
|
||||
[node name="CanvasLayer" parent="Control" instance=ExtResource("3_rybt6")]
|
||||
[node name="CanvasLayer" parent="." instance=ExtResource("3_rybt6")]
|
||||
|
||||
[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("2_ogwi7")
|
||||
|
||||
[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_pv7fe")
|
||||
text = ">"
|
||||
|
||||
[node name="back" type="Button" parent="Control/VBoxContainer/BackToMenu"]
|
||||
layout_mode = 2
|
||||
text = "back to menu"
|
||||
flat = true
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/BackToMenu/back" to="Control" method="_return_to_main_menu"]
|
||||
|
|
|
@ -34,54 +34,54 @@ layout_mode = 2
|
|||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="Control/VBoxContainer"]
|
||||
[node name="Buttons" type="VBoxContainer" parent="Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/Buttons"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer"]
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/Buttons/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(8, 0)
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||
text = ">"
|
||||
|
||||
[node name="start" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer"]
|
||||
[node name="start" type="Button" parent="Control/VBoxContainer/Buttons/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "start"
|
||||
flat = true
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer/Buttons"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer2"]
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/Buttons/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(8, 0)
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||
text = ">"
|
||||
|
||||
[node name="credits" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer2"]
|
||||
[node name="credits" type="Button" parent="Control/VBoxContainer/Buttons/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "credits"
|
||||
flat = true
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="Control/VBoxContainer/VBoxContainer3"]
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="Control/VBoxContainer/Buttons"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer3"]
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/Buttons/HBoxContainer3"]
|
||||
custom_minimum_size = Vector2(8, 0)
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("1_1tx2i")
|
||||
text = ">"
|
||||
|
||||
[node name="quit" type="Button" parent="Control/VBoxContainer/VBoxContainer3/HBoxContainer3"]
|
||||
[node name="quit" type="Button" parent="Control/VBoxContainer/Buttons/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
text = "quit"
|
||||
flat = true
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer/start" to="Control" method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer2/credits" to="Control" method="_on_credits_button_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/VBoxContainer3/HBoxContainer3/quit" to="Control" method="_on_quit_button_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Buttons/HBoxContainer/start" to="Control" method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Buttons/HBoxContainer2/credits" to="Control" method="_on_credits_button_pressed"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Buttons/HBoxContainer3/quit" to="Control" method="_on_quit_button_pressed"]
|
||||
|
|
|
@ -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
Reference in a new issue