event system and keyboard

This commit is contained in:
2025-10-16 00:54:49 +02:00
parent f87cc28c57
commit 69c3e6f396
11 changed files with 313 additions and 6 deletions

84
scenes/levels/home.tscn Normal file
View File

@@ -0,0 +1,84 @@
[gd_scene load_steps=5 format=4 uid="uid://ccfdsdgaon63m"]
[ext_resource type="PackedScene" uid="uid://dfbomt0l6b1o4" path="res://scenes/player.tscn" id="1_ikf4c"]
[ext_resource type="Texture2D" uid="uid://dve2b2glwitsw" path="res://assets/textures/tilemaps/grass_tilemap.png" id="1_q28r8"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_2vl8h"]
texture = ExtResource("1_q28r8")
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
0:2/0 = 0
1:2/0 = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
0:3/0 = 0
1:3/0 = 0
2:3/0 = 0
3:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
0:5/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
0:6/0 = 0
1:6/0 = 0
2:6/0 = 0
3:6/0 = 0
4:6/0 = 0
5:6/0 = 0
6:6/0 = 0
7:6/0 = 0
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
[sub_resource type="TileSet" id="TileSet_ikf4c"]
sources/1 = SubResource("TileSetAtlasSource_2vl8h")
[node name="Home" type="Node2D"]
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAGAAMAAQACAAMAAAAGAAQAAQACAAMAAAAGAAUAAQACAAMAAAAGAAYAAQACAAMAAAAGAAcAAQACAAMAAAAGAAgAAQACAAMAAAAGAAkAAQACAAMAAAAGAAoAAQACAAMAAAAGAAsAAQACAAMAAAAGAAwAAQACAAMAAAAHAAMAAQACAAMAAAAHAAQAAQACAAMAAAAHAAUAAQACAAMAAAAHAAYAAQACAAMAAAAHAAcAAQACAAMAAAAHAAgAAQACAAMAAAAHAAkAAQACAAMAAAAHAAoAAQACAAMAAAAHAAsAAQACAAMAAAAHAAwAAQACAAMAAAAIAAMAAQACAAMAAAAIAAQAAQACAAMAAAAIAAUAAQACAAMAAAAIAAYAAQACAAMAAAAIAAcAAQACAAMAAAAIAAgAAQACAAMAAAAIAAkAAQACAAMAAAAIAAoAAQACAAMAAAAIAAsAAQACAAMAAAAIAAwAAQACAAMAAAAJAAMAAQACAAMAAAAJAAQAAQACAAMAAAAJAAUAAQACAAMAAAAJAAYAAQACAAMAAAAJAAcAAQACAAMAAAAJAAgAAQACAAMAAAAJAAkAAQACAAMAAAAJAAoAAQACAAMAAAAJAAsAAQACAAMAAAAJAAwAAQACAAMAAAAKAAMAAQACAAMAAAAKAAQAAQACAAMAAAAKAAUAAQACAAMAAAAKAAYAAQACAAMAAAAKAAcAAQACAAMAAAAKAAgAAQACAAMAAAAKAAkAAQACAAMAAAAKAAoAAQACAAMAAAAKAAsAAQACAAMAAAAKAAwAAQACAAMAAAALAAMAAQACAAMAAAALAAQAAQACAAMAAAALAAUAAQACAAMAAAALAAYAAQACAAMAAAALAAcAAQACAAMAAAALAAgAAQACAAMAAAALAAkAAQACAAMAAAALAAoAAQACAAMAAAALAAsAAQACAAMAAAALAAwAAQACAAMAAAAMAAMAAQACAAMAAAAMAAQAAQACAAMAAAAMAAUAAQACAAMAAAAMAAYAAQACAAMAAAAMAAcAAQACAAMAAAAMAAgAAQACAAMAAAAMAAkAAQACAAMAAAAMAAoAAQACAAMAAAAMAAsAAQACAAMAAAAMAAwAAQACAAMAAAANAAMAAQACAAMAAAANAAQAAQACAAMAAAANAAUAAQACAAMAAAANAAYAAQACAAMAAAANAAcAAQACAAMAAAANAAgAAQACAAMAAAANAAkAAQACAAMAAAANAAoAAQACAAMAAAANAAsAAQACAAMAAAANAAwAAQACAAMAAAAOAAMAAQACAAMAAAAOAAQAAQACAAMAAAAOAAUAAQACAAMAAAAOAAYAAQACAAMAAAAOAAcAAQACAAMAAAAOAAgAAQACAAMAAAAOAAkAAQACAAMAAAAOAAoAAQACAAMAAAAOAAsAAQACAAMAAAAOAAwAAQACAAMAAAAPAAMAAQACAAMAAAAPAAQAAQACAAMAAAAPAAUAAQACAAMAAAAPAAYAAQACAAMAAAAPAAcAAQACAAMAAAAPAAgAAQACAAMAAAAPAAkAAQACAAMAAAAPAAoAAQACAAMAAAAPAAsAAQACAAMAAAAPAAwAAQACAAMAAAA=")
tile_set = SubResource("TileSet_ikf4c")
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("1_ikf4c")]
position = Vector2(180, 183)
tilemap = NodePath("../TileMapLayer")

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://cd657k2lc3gyc"]
[gd_scene load_steps=3 format=3 uid="uid://cd657k2lc3gyc"]
[ext_resource type="Script" uid="uid://cs1ylnivyrbc2" path="res://scripts/menus/profile_creator.gd" id="1_4xjd5"]
[ext_resource type="FontFile" uid="uid://s0mghd0bccm0" path="res://assets/fonts/monogram-extended.ttf" id="2_yd267"]
[node name="ProfileCreator" type="Control"]
layout_mode = 3
@@ -27,6 +28,7 @@ grow_vertical = 2
[node name="LineEdit" type="LineEdit" parent="VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_yd267")
placeholder_text = "Name him"
editable = false
context_menu_enabled = false
@@ -44,14 +46,12 @@ alignment = 1
[node name="Back" type="Button" parent="VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
theme_override_font_sizes/font_size = 8
text = "Back"
[node name="Next" type="Button" parent="VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
size_flags_vertical = 4
theme_override_font_sizes/font_size = 8
text = "Next"
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Back" to="." method="_on_back_button_pressed"]

View File

@@ -0,0 +1,159 @@
[gd_scene load_steps=2 format=3 uid="uid://dn0lr1sbir3d3"]
[ext_resource type="Script" uid="uid://bxquk4wo56r22" path="res://scripts/menus/util/keyboard.gd" id="1_xrtsm"]
[node name="Keyboard" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
script = ExtResource("1_xrtsm")
[node name="MainKeys" type="HFlowContainer" parent="."]
custom_minimum_size = Vector2(230, 100)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -115.0
offset_top = -50.0
offset_right = 115.0
offset_bottom = 50.0
grow_horizontal = 2
grow_vertical = 2
[node name="Button" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "A"
[node name="Button2" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "B"
[node name="Button3" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "C"
[node name="Button4" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "D"
[node name="Button5" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "E"
[node name="Button6" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "F"
[node name="Button7" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "G"
[node name="Button8" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "H"
[node name="Button9" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "I"
[node name="Button10" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "J"
[node name="Button11" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "K"
[node name="Button12" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "L"
[node name="Button13" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "M"
[node name="Button14" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "N"
[node name="Button15" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "O"
[node name="Button16" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "P"
[node name="Button17" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "Q"
[node name="Button18" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "R"
[node name="Button19" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "S"
[node name="Button20" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "T"
[node name="Button21" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "U"
[node name="Button22" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "V"
[node name="Button23" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "W"
[node name="Button24" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "X"
[node name="Button25" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "Y"
[node name="Button26" type="Button" parent="MainKeys"]
custom_minimum_size = Vector2(22, 22)
layout_mode = 2
text = "Z"