feat: add ice block variant; add button variant;
This commit is contained in:
@@ -2,16 +2,7 @@ extends Area2D
|
||||
var bodies_on_top = 0
|
||||
signal pressed
|
||||
signal unpressed
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
@export var is_single_use: bool = false
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
bodies_on_top = bodies_on_top + 1
|
||||
@@ -21,6 +12,8 @@ func _on_body_entered(body: Node2D) -> void:
|
||||
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
if is_single_use:
|
||||
return
|
||||
bodies_on_top = bodies_on_top - 1
|
||||
if (body.is_in_group("pushable") or body is Player) and bodies_on_top == 0:
|
||||
$AnimatedSprite2D.play("unpressed")
|
||||
|
||||
@@ -34,6 +34,8 @@ animations = [{
|
||||
}]
|
||||
|
||||
[node name="PuzzleButton" type="Area2D" unique_id=125477561]
|
||||
collision_layer = 4
|
||||
collision_mask = 15
|
||||
script = ExtResource("1_dls00")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=389969783]
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
[gd_scene format=3 uid="uid://bvdp8m47ia2n3"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://onpen57mc6i8" path="res://Scenes/PuzzleButton/puzzle_button.tscn" id="1_8h8a6"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0v63n2kjtvvu" path="res://Ninja Adventure - Asset Pack/Backgrounds/Tilesets/TilesetDungeon.png" id="2_spa4x"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5fq82"]
|
||||
atlas = ExtResource("2_spa4x")
|
||||
region = Rect2(48, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5w5pl"]
|
||||
atlas = ExtResource("2_spa4x")
|
||||
region = Rect2(32, 16, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_25pb2"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5fq82")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"pressed",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5w5pl")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"unpressed",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="PuzzleButtonSingleUse" unique_id=125477561 instance=ExtResource("1_8h8a6")]
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1" unique_id=1705118892]
|
||||
sprite_frames = SubResource("SpriteFrames_25pb2")
|
||||
animation = &"pressed"
|
||||
Reference in New Issue
Block a user