Splitted decorative and informative sprite atlases. Fixed interaction hover tip for pad
This commit is contained in:
@@ -2,26 +2,26 @@ class_name AbstractActivatableObject
|
||||
extends Node2D
|
||||
|
||||
|
||||
@onready var hint_sprite : Sprite2D = $HintSprite
|
||||
@onready var hover_tip : Node2D = $HoverTip
|
||||
|
||||
|
||||
var _player_in_range := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
hint_sprite.hide()
|
||||
hover_tip.hide()
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body is Player:
|
||||
hint_sprite.show()
|
||||
hover_tip.show()
|
||||
_player_in_range = true
|
||||
body.interacted.connect(_activate)
|
||||
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
if body is Player:
|
||||
hint_sprite.hide()
|
||||
hover_tip.hide()
|
||||
_player_in_range = false
|
||||
body.interacted.disconnect(_activate)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://725frvpqe1c8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cfqo4k2uarorm" path="res://game/objects/interactive/abstract_activatable_object.gd" id="1_b4djr"]
|
||||
[ext_resource type="Texture2D" uid="uid://c42nswehn307r" path="res://images/level/activation_hint.png" id="1_rexes"]
|
||||
[ext_resource type="PackedScene" uid="uid://bj1en1mlmo6tn" path="res://game/objects/informative/interaction_action_hover_tip.tscn" id="2_b4djr"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_n2cvl"]
|
||||
|
||||
@@ -13,8 +13,7 @@ script = ExtResource("1_b4djr")
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2065213362]
|
||||
shape = SubResource("CircleShape2D_n2cvl")
|
||||
|
||||
[node name="HintSprite" type="Sprite2D" parent="." unique_id=1362423739]
|
||||
texture = ExtResource("1_rexes")
|
||||
[node name="HoverTip" parent="." unique_id=1961962362 instance=ExtResource("2_b4djr")]
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
|
||||
@@ -39,7 +39,7 @@ func _activate() -> void:
|
||||
var set_state := func(state: State) -> void:
|
||||
_current_state = state
|
||||
_update_animation()
|
||||
hint_sprite.hide()
|
||||
hover_tip.hide()
|
||||
switching.emit()
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_lever, global_position)
|
||||
|
||||
@@ -61,7 +61,7 @@ func _on_animation_finished() -> void:
|
||||
_update_animation()
|
||||
switched.emit()
|
||||
if _player_in_range:
|
||||
hint_sprite.show()
|
||||
hover_tip.show()
|
||||
|
||||
match _current_state:
|
||||
State.TurningLeft:
|
||||
|
||||
@@ -53,7 +53,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ap6wp")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": 1,
|
||||
"name": &"turned_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -61,7 +61,7 @@ animations = [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wb3bq")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": 1,
|
||||
"name": &"turned_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
@@ -78,7 +78,7 @@ animations = [{
|
||||
"duration": 2.0,
|
||||
"texture": SubResource("AtlasTexture_eom63")
|
||||
}],
|
||||
"loop": false,
|
||||
"loop": 0,
|
||||
"name": &"turning_left",
|
||||
"speed": 20.0
|
||||
}, {
|
||||
@@ -95,7 +95,7 @@ animations = [{
|
||||
"duration": 2.0,
|
||||
"texture": SubResource("AtlasTexture_5h41l")
|
||||
}],
|
||||
"loop": false,
|
||||
"loop": 0,
|
||||
"name": &"turning_right",
|
||||
"speed": 20.0
|
||||
}]
|
||||
@@ -112,7 +112,7 @@ initial_state = 0
|
||||
position = Vector2(0, -4)
|
||||
shape = SubResource("RectangleShape2D_tnscr")
|
||||
|
||||
[node name="HintSprite" parent="." index="1" unique_id=1362423739]
|
||||
[node name="HoverTip" parent="." index="1" unique_id=1961962362]
|
||||
position = Vector2(0, -11)
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="2" unique_id=2086579452]
|
||||
|
||||
Reference in New Issue
Block a user