changed menu navigation
This commit is contained in:
parent
9b890c6bd2
commit
033718351e
7 changed files with 248 additions and 33 deletions
49
gmtk_2024/menu/main_menu/Cre73AB.tmp
Normal file
49
gmtk_2024/menu/main_menu/Cre73AB.tmp
Normal file
|
@ -0,0 +1,49 @@
|
|||
[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
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_tmf11")
|
||||
|
||||
[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"]
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[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/menu_credit_control.gd" id="3_hokr0"]
|
||||
[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"]
|
||||
|
@ -21,7 +21,7 @@ color = Color(0, 0, 0, 1)
|
|||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 2
|
||||
script = ExtResource("3_hokr0")
|
||||
script = ExtResource("3_38v2l")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||
layout_mode = 0
|
||||
|
|
|
@ -55,6 +55,22 @@ r={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
accept={
|
||||
"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)
|
||||
, 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":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
66
gmtk_2024/scripts/level_completed_control.gd
Normal file
66
gmtk_2024/scripts/level_completed_control.gd
Normal file
|
@ -0,0 +1,66 @@
|
|||
extends Control
|
||||
|
||||
var credits_text = """
|
||||
CONGRATULATIONS
|
||||
THIS SECTOR IS NOW INFECTED
|
||||
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 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:
|
||||
# Ü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
|
||||
|
||||
typing_speed = fast_typing_speed if is_fast_typing else 0.05
|
||||
|
||||
func _start_typing() -> void:
|
||||
current_text = ""
|
||||
char_index = 0
|
||||
_update_text()
|
||||
|
||||
func _update_text() -> void:
|
||||
if char_index < credits_text.length():
|
||||
current_text += credits_text[char_index]
|
||||
$VBoxContainer/Label.text = current_text
|
||||
char_index += 1
|
||||
await get_tree().create_timer(typing_speed).timeout
|
||||
_update_text()
|
||||
else:
|
||||
_show_menu_options()
|
||||
|
||||
func _show_menu_options() -> void:
|
||||
$VBoxContainer/BackToMenu.visible = true
|
||||
|
||||
func _return_to_main_menu() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.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
|
|
@ -1,6 +1,7 @@
|
|||
extends Control
|
||||
|
||||
func _ready():
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
setup_level_box()
|
||||
connect_level_selected_to_level_box()
|
||||
|
||||
|
|
|
@ -1,38 +1,72 @@
|
|||
extends Control
|
||||
|
||||
var credits_text = """
|
||||
SECTOR COMPLETED
|
||||
CREDITS:
|
||||
-----------
|
||||
Programming: Jannis, Fabio
|
||||
Pixel Art : Leon
|
||||
Music: TBN
|
||||
|
||||
"""
|
||||
|
||||
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:
|
||||
|
@ -43,18 +77,20 @@ 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:
|
||||
$VBoxContainer/BackToMenu.visible = true
|
||||
|
||||
func _return_to_main_menu() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.tscn")
|
||||
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()
|
||||
is_typing = false
|
||||
_show_menu_options()
|
||||
|
||||
func get_time_since_last_click() -> float:
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
extends Control
|
||||
|
||||
var display_text = """
|
||||
SYSTEM INITIALIZATION...
|
||||
STARTING Infiltrate.exe ...
|
||||
---------------------------------------
|
||||
PLACEHOLDER GAME NAME BOOT SEQUENCE
|
||||
COPYRIGHT PLACEHOLDER
|
||||
MADE FOR GMTK GAME JAM 2024
|
||||
|
||||
>> WARNING:
|
||||
>> RECOMMENDED ACTION:
|
||||
>> SECURITY PROTOCOLS: ACTIVE
|
||||
>> SCANNING FOR THREATS...
|
||||
|
||||
>> WARNING: UNAUTHORIZED ACCESS DETECTED
|
||||
>> INITIALIZING COUNTERMEASURES...
|
||||
|
||||
SYSTEM READY.
|
||||
PRESS START TO GET ACCESS.
|
||||
|
||||
"""
|
||||
|
@ -21,26 +21,71 @@ var typing_speed = 0.05
|
|||
var fast_typing_speed = 0.0001
|
||||
var last_click_time = 0.0
|
||||
var double_click_time = 0.3
|
||||
var is_typing = true
|
||||
var current_button_index = 0
|
||||
var buttons = []
|
||||
|
||||
func _ready():
|
||||
for hbox in $VBoxContainer/Buttons.get_children():
|
||||
hbox.visible = false
|
||||
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
_initialize_menu()
|
||||
_start_typing()
|
||||
|
||||
func _initialize_menu():
|
||||
buttons = $VBoxContainer/Buttons.get_children()
|
||||
_update_button_visibility()
|
||||
_blink_current_button()
|
||||
|
||||
func _update_button_visibility():
|
||||
for i in range(len(buttons)):
|
||||
var hbox_container = buttons[i]
|
||||
var label_node = hbox_container.get_child(0)
|
||||
if label_node != null:
|
||||
label_node.visible = (i == current_button_index)
|
||||
|
||||
func _blink_current_button() -> void:
|
||||
while true:
|
||||
var hbox_container = buttons[current_button_index]
|
||||
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 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
|
||||
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_down") or event.is_action_pressed("down"):
|
||||
current_button_index = (current_button_index + 1) % buttons.size()
|
||||
_update_button_visibility()
|
||||
elif event.is_action_pressed("ui_up") or event.is_action_pressed("up"):
|
||||
current_button_index = (current_button_index - 1 + buttons.size()) % buttons.size()
|
||||
_update_button_visibility()
|
||||
elif event.is_action_pressed("ui_accept"):
|
||||
buttons[current_button_index].get_child(1).emit_signal("pressed")
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
typing_speed = 0.05 # Zurück zur normalen Geschwindigkeit
|
||||
if not is_typing:
|
||||
if Input.is_action_pressed("ui_accept"):
|
||||
typing_speed = fast_typing_speed
|
||||
|
||||
func _start_typing() -> void:
|
||||
current_text = ""
|
||||
char_index = 0
|
||||
is_typing = true
|
||||
_update_text()
|
||||
|
||||
func _update_text() -> void:
|
||||
|
@ -51,6 +96,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:
|
||||
|
@ -61,6 +107,7 @@ func _show_full_text() -> void:
|
|||
current_text = display_text
|
||||
$VBoxContainer/VBoxContainer2/Label.text = current_text
|
||||
char_index = display_text.length()
|
||||
is_typing = false
|
||||
_show_menu_options()
|
||||
|
||||
func get_time_since_last_click() -> float:
|
||||
|
@ -76,6 +123,6 @@ func _on_credits_button_pressed() -> void:
|
|||
get_tree().change_scene_to_file("res://menu/main_menu/CreditsScene.tscn")
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
$VBoxContainer/VBoxContainer2/Label.text += "\nLogging out!"
|
||||
$VBoxContainer/VBoxContainer2/Label.text += "Logging out!"
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
get_tree().quit()
|
||||
|
|
Loading…
Add table
Reference in a new issue