amélioration de la commande tactile
les clues sont dépendantes du contexte elles affichent un bouton si on est au clavier un doigt si on est à la souris ou au doigt
This commit is contained in:
@@ -2,9 +2,14 @@ extends Sprite2D
|
||||
class_name BubbleClue
|
||||
|
||||
func setVisible(isV: bool):
|
||||
$ButtonClue.setVisible(false)
|
||||
$TouchClue.setVisible(false)
|
||||
visible = isV
|
||||
if isV:
|
||||
$AnimationPlayer.play("move")
|
||||
if GameState.isUsingTouch:
|
||||
$TouchClue.setVisible(true)
|
||||
else:
|
||||
$ButtonClue.setVisible(true)
|
||||
else:
|
||||
$AnimationPlayer.stop()
|
||||
$Sprite2D.setVisible(isV)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dn10ervwv15oo"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dn10ervwv15oo"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cwbhdira3w8qx" path="res://assest/ui/UI_48x48.png" id="1_o6ktm"]
|
||||
[ext_resource type="Script" path="res://UI/clues/bubble_clue.gd" id="2_u6r66"]
|
||||
[ext_resource type="PackedScene" uid="uid://clqdxhwojbkwp" path="res://UI/clues/button_clue.tscn" id="3_p3oka"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnauf5lsaj63n" path="res://UI/clues/touch_clue.tscn" id="4_ei01g"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_srt4p"]
|
||||
loop_mode = 1
|
||||
@@ -21,7 +22,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:position")
|
||||
tracks/1/path = NodePath("ButtonClue:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@@ -30,6 +31,18 @@ tracks/1/keys = {
|
||||
"update": 0,
|
||||
"values": [Vector2(1, -5)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("TouchClue:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_puwvl"]
|
||||
resource_name = "move"
|
||||
@@ -49,7 +62,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:position")
|
||||
tracks/1/path = NodePath("ButtonClue:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@@ -58,6 +71,18 @@ tracks/1/keys = {
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -5), Vector2(0, -4), Vector2(0, -3), Vector2(0, -4)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("TouchClue:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.266667, 0.533333, 0.733333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-9.53674e-07, 4), Vector2(0, 5), Vector2(0, 6), Vector2(0, 5)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kli7q"]
|
||||
_data = {
|
||||
@@ -72,10 +97,14 @@ vframes = 9
|
||||
frame = 5
|
||||
script = ExtResource("2_u6r66")
|
||||
|
||||
[node name="Sprite2D" parent="." instance=ExtResource("3_p3oka")]
|
||||
[node name="ButtonClue" parent="." instance=ExtResource("3_p3oka")]
|
||||
position = Vector2(1, -5)
|
||||
scale = Vector2(0.401042, 0.401042)
|
||||
|
||||
[node name="TouchClue" parent="." instance=ExtResource("4_ei01g")]
|
||||
position = Vector2(0, 5.23667)
|
||||
scale = Vector2(0.416667, 0.416667)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kli7q")
|
||||
|
||||
36
UI/clues/touch_clue.tscn
Normal file
36
UI/clues/touch_clue.tscn
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dnauf5lsaj63n"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cwbhdira3w8qx" path="res://assest/ui/UI_48x48.png" id="1_nlo3w"]
|
||||
[ext_resource type="Script" path="res://UI/clues/button_clue.gd" id="2_4uok5"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_srt4p"]
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.233333, 0.5, 0.733333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [74, 92, 94, 76]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kli7q"]
|
||||
_data = {
|
||||
"move": SubResource("Animation_srt4p")
|
||||
}
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D"]
|
||||
texture = ExtResource("1_nlo3w")
|
||||
hframes = 18
|
||||
vframes = 16
|
||||
frame = 74
|
||||
script = ExtResource("2_4uok5")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kli7q")
|
||||
}
|
||||
Reference in New Issue
Block a user