diff options
author | kdx <kikoodx@paranoici.org> | 2023-10-28 23:11:01 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-10-28 23:11:01 +0200 |
commit | 98f6cf85e895ea611f97f59eb8f3ea325b485016 (patch) | |
tree | 42a5c4ba8d8ce054724c3017523c37a36bd1e3ba | |
parent | 57c950c03d1ae9cc59f5abdb5e4825d6a27a1160 (diff) | |
download | genshin2-98f6cf85e895ea611f97f59eb8f3ea325b485016.tar.gz |
luigi
-rw-r--r-- | Globals.gd | 2 | ||||
-rw-r--r-- | SignalHub.gd | 4 | ||||
-rw-r--r-- | characters.gd | 24 | ||||
-rw-r--r-- | characters.png | bin | 0 -> 249590 bytes | |||
-rw-r--r-- | characters.png.import (renamed from venti.png.import) | 8 | ||||
-rw-r--r-- | characters.tscn | 15 | ||||
-rw-r--r-- | game.tscn | 8 | ||||
-rw-r--r-- | player.gd | 8 | ||||
-rw-r--r-- | player.tscn | 5 | ||||
-rw-r--r-- | project.godot | 24 | ||||
-rw-r--r-- | venti.png | bin | 173127 -> 0 bytes |
11 files changed, 90 insertions, 8 deletions
@@ -1,3 +1,5 @@ +extends Node + const WIDTH = 2048 const HEIGHT = 2048 const LIMITS = Vector2(WIDTH, HEIGHT) diff --git a/SignalHub.gd b/SignalHub.gd new file mode 100644 index 0000000..83291db --- /dev/null +++ b/SignalHub.gd @@ -0,0 +1,4 @@ +extends Node + + +signal select_character(String) diff --git a/characters.gd b/characters.gd index e97d7d2..72aabf4 100644 --- a/characters.gd +++ b/characters.gd @@ -2,14 +2,34 @@ extends Node2D @onready var selected: bool = (name == "Characters") @export var label: String = "venti" +@export var key: String = "" func _ready() -> void: - if !selected: label = "" + if selected: + get_node("../../../Player").select_character(label) + SignalHub.select_character.connect(_new_selection) # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: $Selected.visible = selected $Unselected.visible = !$Selected.visible $Label.text = label + if Input.is_action_just_pressed(key): + select() + + +func _on_button_pressed() -> void: + select() + + +func select() -> void: + if label: + SignalHub.select_character.emit(label) + + +func _new_selection(s: String) -> void: + selected = (s == label) + if selected: + get_node("../../../Player").select_character(label) diff --git a/characters.png b/characters.png Binary files differnew file mode 100644 index 0000000..1316647 --- /dev/null +++ b/characters.png diff --git a/venti.png.import b/characters.png.import index af297bf..40368f4 100644 --- a/venti.png.import +++ b/characters.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://c0fftnutausax" -path="res://.godot/imported/venti.png-ee1b1a47b12da75cb91dabbe9c70519b.ctex" +uid="uid://cq3m7fo355xdf" +path="res://.godot/imported/characters.png-dc980dfb95e1937992a0ee9ad6b94288.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://venti.png" -dest_files=["res://.godot/imported/venti.png-ee1b1a47b12da75cb91dabbe9c70519b.ctex"] +source_file="res://characters.png" +dest_files=["res://.godot/imported/characters.png-dc980dfb95e1937992a0ee9ad6b94288.ctex"] [params] diff --git a/characters.tscn b/characters.tscn index 41761f9..c3c4ce7 100644 --- a/characters.tscn +++ b/characters.tscn @@ -58,3 +58,18 @@ text = "venti" label_settings = SubResource("LabelSettings_agl8u") horizontal_alignment = 2 vertical_alignment = 1 + +[node name="Button" type="Button" parent="."] +modulate = Color(1, 1, 1, 0) +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -325.0 +offset_top = -31.0 +offset_bottom = 31.0 +grow_horizontal = 0 +grow_vertical = 2 + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] @@ -66,15 +66,23 @@ texture = ExtResource("9_tsf5s") [node name="Characters" parent="CanvasUI/UI" instance=ExtResource("5_cbcae")] position = Vector2(1280, 320) +label = "venti" +key = "1" [node name="Characters2" parent="CanvasUI/UI" instance=ExtResource("5_cbcae")] position = Vector2(1280, 400) +label = "luigi" +key = "2" [node name="Characters3" parent="CanvasUI/UI" instance=ExtResource("5_cbcae")] position = Vector2(1280, 480) +label = "" +key = "3" [node name="Characters4" parent="CanvasUI/UI" instance=ExtResource("5_cbcae")] position = Vector2(1281, 559) +label = "" +key = "4" [node name="Genshinlogo" type="Sprite2D" parent="."] texture = ExtResource("1_tfg20") @@ -44,3 +44,11 @@ func _on_area_entered(area: Area2D) -> void: sfx = (sfx + 1) % len(sfxs) primogemmes.count += 1 $Sprite2D.rotation_degrees += 90 + + +func select_character(s: String) -> void: + match s: + "venti": + $Sprite2D.frame = 0 + "luigi": + $Sprite2D.frame = 1 diff --git a/player.tscn b/player.tscn index f788c52..602c8a4 100644 --- a/player.tscn +++ b/player.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=7 format=3 uid="uid://c2g45v321qddb"] [ext_resource type="Script" path="res://player.gd" id="1_tleme"] -[ext_resource type="Texture2D" uid="uid://c0fftnutausax" path="res://venti.png" id="2_f564p"] +[ext_resource type="Texture2D" uid="uid://cq3m7fo355xdf" path="res://characters.png" id="2_mu4pp"] [ext_resource type="AudioStream" uid="uid://siphq0i4rti2" path="res://oo.wav" id="3_0gvk7"] [ext_resource type="AudioStream" uid="uid://dnx38lwh4b34a" path="res://ee.wav" id="4_on1ta"] [ext_resource type="AudioStream" uid="uid://xbua3i4neqg5" path="res://oo2.wav" id="5_be6a0"] @@ -16,7 +16,8 @@ metadata/_edit_group_ = true [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(0.4, 0.4) -texture = ExtResource("2_f564p") +texture = ExtResource("2_mu4pp") +hframes = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_kt8c8") diff --git a/project.godot b/project.godot index 166ef9a..80cbbfd 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="res://icon.svg" [autoload] Globals="*res://Globals.gd" +SignalHub="*res://SignalHub.gd" [display] @@ -26,6 +27,29 @@ window/size/viewport_height=960 window/stretch/mode="canvas_items" mouse_cursor/custom_image="res://cursor.png" +[input] + +1={ +"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":49,"physical_keycode":49,"key_label":49,"unicode":0,"echo":false,"script":null) +] +} +2={ +"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":50,"key_label":0,"unicode":50,"echo":false,"script":null) +] +} +3={ +"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":51,"key_label":0,"unicode":51,"echo":false,"script":null) +] +} +4={ +"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":52,"key_label":0,"unicode":52,"echo":false,"script":null) +] +} + [rendering] renderer/rendering_method="gl_compatibility" diff --git a/venti.png b/venti.png Binary files differdeleted file mode 100644 index 97901fa..0000000 --- a/venti.png +++ /dev/null |