Added level 1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
class_name ContolGuidanceSwitcher
|
||||
extends Node
|
||||
|
||||
|
||||
@export var keyboard_guidance : Guidance
|
||||
@export var gamepad_guidance : Guidance
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if not Engine.is_editor_hint():
|
||||
_updated_by_input_type(InputManager.get_type())
|
||||
InputManager.type_changed.connect(_updated_by_input_type)
|
||||
|
||||
|
||||
func _updated_by_input_type(type: InputManager.Type) -> void:
|
||||
match type:
|
||||
InputManager.Type.Keyboard:
|
||||
if keyboard_guidance:
|
||||
keyboard_guidance.show()
|
||||
if gamepad_guidance:
|
||||
gamepad_guidance.hide()
|
||||
InputManager.Type.Gamepad:
|
||||
if keyboard_guidance:
|
||||
keyboard_guidance.hide()
|
||||
if gamepad_guidance:
|
||||
gamepad_guidance.show()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbhog55aay31d
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://dcls1laigghr4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbhog55aay31d" path="res://game/entities/guidance/control_guidance_switcher.gd" id="1_mw6mb"]
|
||||
|
||||
[node name="ControlGuidanceSwitcher" type="Node" unique_id=552528483]
|
||||
script = ExtResource("1_mw6mb")
|
||||
@@ -0,0 +1,45 @@
|
||||
@tool
|
||||
class_name Guidance
|
||||
extends Node2D
|
||||
|
||||
|
||||
enum Size {
|
||||
Small,
|
||||
Big,
|
||||
}
|
||||
|
||||
|
||||
@export var size := Size.Small:
|
||||
set(value):
|
||||
size = value
|
||||
if is_node_ready():
|
||||
_update_size()
|
||||
|
||||
@export var text := "":
|
||||
set(value):
|
||||
text = value
|
||||
if is_node_ready():
|
||||
_update_text()
|
||||
|
||||
|
||||
@onready var small_sprite : Sprite2D = $SmallSprite
|
||||
@onready var big_sprite : Sprite2D = $BigSprite
|
||||
@onready var label : Label = $Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_update_size()
|
||||
_update_text()
|
||||
|
||||
|
||||
func _update_size() -> void:
|
||||
match size:
|
||||
Size.Small:
|
||||
small_sprite.show()
|
||||
big_sprite.hide()
|
||||
Size.Big:
|
||||
small_sprite.hide()
|
||||
big_sprite.show()
|
||||
|
||||
func _update_text() -> void:
|
||||
label.text = text
|
||||
@@ -0,0 +1 @@
|
||||
uid://unj7gyl50bh4
|
||||
@@ -0,0 +1,33 @@
|
||||
[gd_scene format=3 uid="uid://d8wwtdj30wwr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://unj7gyl50bh4" path="res://game/entities/guidance/guidance.gd" id="1_0gb2d"]
|
||||
[ext_resource type="Texture2D" uid="uid://dc3j8hs0ld4cg" path="res://images/entities/guidance.png" id="2_37fbl"]
|
||||
[ext_resource type="Theme" uid="uid://bqj884yfvhhft" path="res://game/themes/main_menu.tres" id="3_1vdxa"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0gb2d"]
|
||||
atlas = ExtResource("2_37fbl")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_37fbl"]
|
||||
atlas = ExtResource("2_37fbl")
|
||||
region = Rect2(48, 0, 96, 48)
|
||||
|
||||
[node name="Guidance" type="Node2D" unique_id=1797017316]
|
||||
script = ExtResource("1_0gb2d")
|
||||
|
||||
[node name="SmallSprite" type="Sprite2D" parent="." unique_id=1649957299]
|
||||
texture = SubResource("AtlasTexture_0gb2d")
|
||||
|
||||
[node name="BigSprite" type="Sprite2D" parent="." unique_id=835120450]
|
||||
visible = false
|
||||
texture = SubResource("AtlasTexture_37fbl")
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=1747099762]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("3_1vdxa")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
Reference in New Issue
Block a user