feat: add ice block variant; add button variant;
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c0v63n2kjtvvu" path="res://Ninja Adventure - Asset Pack/Backgrounds/Tilesets/TilesetDungeon.png" id="1_83tkd"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_n5fck"]
|
||||
bounce = 0.8
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bqpwv"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
@@ -10,6 +13,9 @@ atlas = ExtResource("1_83tkd")
|
||||
region = Rect2(127.859436, 47.936436, 16.21347, 16.062302)
|
||||
|
||||
[node name="Block" type="RigidBody2D" unique_id=2096944035 groups=["pushable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 15
|
||||
physics_material_override = SubResource("PhysicsMaterial_n5fck")
|
||||
gravity_scale = 0.0
|
||||
linear_damp = 10.0
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene format=3 uid="uid://cet4fk631cjyt"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://orvnsdbeji56" path="res://Scenes/Block/block.tscn" id="1_4tccs"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0v63n2kjtvvu" path="res://Ninja Adventure - Asset Pack/Backgrounds/Tilesets/TilesetDungeon.png" id="2_8ron8"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_8ron8"]
|
||||
bounce = 0.1
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_k54aw"]
|
||||
atlas = ExtResource("2_8ron8")
|
||||
region = Rect2(16, 32, 16.21347, 16.062302)
|
||||
|
||||
[node name="IceBlock" unique_id=2096944035 instance=ExtResource("1_4tccs")]
|
||||
physics_material_override = SubResource("PhysicsMaterial_8ron8")
|
||||
linear_damp = 0.2
|
||||
|
||||
[node name="Sprite2D" parent="." index="1" unique_id=605230206]
|
||||
texture = SubResource("AtlasTexture_k54aw")
|
||||
File diff suppressed because one or more lines are too long
@@ -793,7 +793,7 @@ tile_map_data = PackedByteArray("AAD/////AAAMAAgAAAD//wAAAAAMAAgAAAD//wEAAAAMAAg
|
||||
tile_set = SubResource("TileSet_bqpwv")
|
||||
|
||||
[node name="PuzzleButton" parent="." unique_id=125477561 instance=ExtResource("7_ohrk8")]
|
||||
position = Vector2(-37, -33)
|
||||
position = Vector2(183, -86)
|
||||
|
||||
[node name="ObstacleLayer" type="TileMapLayer" parent="." unique_id=703817951]
|
||||
y_sort_enabled = true
|
||||
@@ -806,16 +806,16 @@ push_strength = 100
|
||||
[node name="Camera2D" type="Camera2D" parent="ObstacleLayer/Player" unique_id=1335060572]
|
||||
zoom = Vector2(5, 5)
|
||||
|
||||
[node name="LockedDoor" parent="ObstacleLayer" unique_id=964088255 instance=ExtResource("6_elpgg")]
|
||||
position = Vector2(31, -32)
|
||||
[node name="SceneEntrance" parent="." unique_id=1734357035 instance=ExtResource("5_oi8ly")]
|
||||
position = Vector2(137, -107)
|
||||
|
||||
[node name="LockedDoor" parent="." unique_id=964088255 instance=ExtResource("6_elpgg")]
|
||||
position = Vector2(137, -107)
|
||||
script = ExtResource("7_nr542")
|
||||
|
||||
[node name="SceneEntrance" parent="." unique_id=1734357035 instance=ExtResource("5_oi8ly")]
|
||||
position = Vector2(136, -108)
|
||||
|
||||
[node name="Block" parent="." unique_id=2096944035 instance=ExtResource("6_12ovb")]
|
||||
position = Vector2(0, -33)
|
||||
position = Vector2(163, -75)
|
||||
lock_rotation = true
|
||||
|
||||
[connection signal="pressed" from="PuzzleButton" to="ObstacleLayer/LockedDoor" method="_on_puzzle_button_pressed"]
|
||||
[connection signal="unpressed" from="PuzzleButton" to="ObstacleLayer/LockedDoor" method="_on_puzzle_button_unpressed"]
|
||||
[connection signal="pressed" from="PuzzleButton" to="LockedDoor" method="_on_puzzle_button_pressed"]
|
||||
[connection signal="unpressed" from="PuzzleButton" to="LockedDoor" method="_on_puzzle_button_unpressed"]
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
extends StaticBody2D
|
||||
@export var buttons_pressed_needed = 2
|
||||
var currently_pressed = 0
|
||||
|
||||
func _on_puzzle_button_pressed() -> void:
|
||||
currently_pressed = currently_pressed + 1
|
||||
print("CURRENTLY PRESSED:", currently_pressed)
|
||||
if currently_pressed == buttons_pressed_needed:
|
||||
visible = false
|
||||
$CollisionShape2D.set_deferred("disabled", true)
|
||||
|
||||
|
||||
func _on_puzzle_button_unpressed() -> void:
|
||||
currently_pressed = currently_pressed - 1
|
||||
print("CURRENTLY PRESSED:", currently_pressed)
|
||||
if currently_pressed != buttons_pressed_needed:
|
||||
visible = true
|
||||
$CollisionShape2D.set_deferred("disabled", false)
|
||||
@@ -0,0 +1 @@
|
||||
uid://ckwgcvlmypvi1
|
||||
@@ -8,7 +8,8 @@ class_name Player
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var damage: float = 2
|
||||
position = SceneManager.player_next_scene_spawn_pos
|
||||
if SceneManager.player_next_scene_spawn_pos != Vector2(0, 0):
|
||||
position = SceneManager.player_next_scene_spawn_pos
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
||||
@@ -143,6 +143,7 @@ radius = 5.0
|
||||
height = 10.0
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" unique_id=1991398375]
|
||||
collision_mask = 7
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_a3d8c")
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -3,9 +3,10 @@
|
||||
[ext_resource type="Script" uid="uid://0a6yl260cuo3" path="res://Scenes/SceneEntrance/scene_entrance.gd" id="1_6rkgu"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bqpwv"]
|
||||
size = Vector2(19, 16)
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="SceneEntrance" type="Area2D" unique_id=1734357035]
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_6rkgu")
|
||||
next_scene = "res://Scenes/DungeonScene/dungeon_scene.tscn"
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@ window/stretch/mode="canvas_items"
|
||||
wall="A wall tilemap layer"
|
||||
pushable="A pushuable object"
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="Environment"
|
||||
2d_physics/layer_2="Player"
|
||||
2d_physics/layer_3="Puzzle Elements"
|
||||
2d_physics/layer_4="Puzzle Walls"
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
||||
Reference in New Issue
Block a user