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

Binary file not shown.

View File

@@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://s0mghd0bccm0"
path="res://.godot/imported/monogram-extended.ttf-d0e25f0152286e72083f4de361724351.fontdata"
[deps]
source_file="res://assets/fonts/monogram-extended.ttf"
dest_files=["res://.godot/imported/monogram-extended.ttf-d0e25f0152286e72083f4de361724351.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -35,7 +35,6 @@ window/size/viewport_height=200
window/size/window_width_override=1152
window/size/window_height_override=640
window/stretch/mode="viewport"
window/stretch/scale_mode="integer"
display_server/driver.linuxbsd="wayland"
window/size/mode.release=4
@@ -43,6 +42,13 @@ window/size/mode.release=4
enabled=PackedStringArray("res://addons/dialogue_manager/plugin.cfg")
[gui]
fonts/dynamic_fonts/use_oversampling=false
theme/default_font_antialiasing=0
theme/default_font_subpixel_positioning=0
theme/custom_font="uid://s0mghd0bccm0"
[input]
move_left={

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("AAAGAAMAAQACAAMAAAAGAAQAAQACAAMAAAAGAAUAAQACAAMAAAAGAAYAAQACAAMAAAAGAAcAAQACAAMAAAAGAAgAAQACAAMAAAAGAAkAAQACAAMAAAAGAAoAAQACAAMAAAAGAAsAAQACAAMAAAAGAAwAAQACAAMAAAAHAAMAAQACAAMAAAAHAAQAAQACAAMAAAAHAAUAAQACAAMAAAAHAAYAAQACAAMAAAAHAAcAAQACAAMAAAAHAAgAAQACAAMAAAAHAAkAAQACAAMAAAAHAAoAAQACAAMAAAAHAAsAAQACAA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AAQACAAMAAAAOAAwAAQACAAMAAAAPAAMAAQACAAMAAAAPAAQAAQACAAMAAAAPAAUAAQACAAMAAAAPAAYAAQACAAMAAAAPAAcAAQACAAMAAAAPAAgAAQACAAMAAAAPAAkAAQACAAMAAAAPAAoAAQACAAMAAAAPAAsAAQACAAMAAAAPAAwAAQACAAMAAAA=")
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"

View File

@@ -1,6 +1,24 @@
extends Node
var player_free: bool = true
var player: Player
func transition() -> void:
enum Events { NONE, PUMPKIN_CARVE, OUTSIDE_NORMAL }
var current_event: Events = Events.NONE
func transition_start() -> void:
pass
func transition_end() -> void:
pass
func run_event(event: Events, player_postion: Vector2 = Vector2.ZERO):
current_event = event
transition_start()
if player != null && player_postion != Vector2.ZERO:
player.position = player_postion
match event:
Events.PUMPKIN_CARVE:
get_tree().change_scene_to_file("uid://ccfdsdgaon63m") # scenes/levels/home.tscn
pass
transition_end()

View File

@@ -28,7 +28,7 @@ func update_name() -> void:
next.text = "Finish"
elif index > max_index:
profile.save()
index = max_index
EventManager.run_event(EventManager.Events.PUMPKIN_CARVE)
return
else:
next.text = "Next"

View File

@@ -0,0 +1 @@
extends Control

View File

@@ -0,0 +1 @@
uid://bxquk4wo56r22

View File

@@ -1,3 +1,4 @@
class_name Player
extends CharacterBody2D
const SPEED: int = 800
@@ -9,6 +10,7 @@ var tilesize: int = 32
var position_limit_rect: Rect2
func _ready() -> void:
EventManager.player = self
var used_tilemap_rect: Rect2i = tilemap.get_used_rect()
tilesize = tilemap.tile_set.tile_size.x