This commit is contained in:
Nitsud Yarg 2024-06-22 15:58:23 -07:00
parent e4a6188d89
commit 4bf2a3f788
6 changed files with 122 additions and 2 deletions

BIN
assets/mmz1_door.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/mmz1_door.png-bfbb77cdd4ff4c657c846885aecef8d7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/mmz1_door.png"
dest_files=[ "res://.import/mmz1_door.png-bfbb77cdd4ff4c657c846885aecef8d7.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

14
src/Interactables/Door.gd Normal file
View File

@ -0,0 +1,14 @@
extends Interactable
onready var door_animation: AnimatedSprite = $AnimatedSprite
func trigger_interaction():
door_animation.play("default")
yield( door_animation, "animation_finished")
$StaticBody2D/CollisionShape2D.disabled = true
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
pass

View File

@ -0,0 +1,68 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Door.gd" type="Script" id=2]
[ext_resource path="res://assets/mmz1_door.png" type="Texture" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
region = Rect2( 34, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 3 )
region = Rect2( 68, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 3 )
region = Rect2( 102, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 3 )
region = Rect2( 136, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 3 )
region = Rect2( 170, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 3 )
region = Rect2( 204, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 3 )
region = Rect2( 238, 0, 34, 94 )
[sub_resource type="SpriteFrames" id=9]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ],
"loop": false,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=10]
extents = Vector2( 40, 21 )
[sub_resource type="RectangleShape2D" id=11]
extents = Vector2( 19, 39 )
[node name="Door" instance=ExtResource( 1 )]
collision_layer = 0
collision_mask = 2
script = ExtResource( 2 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = SubResource( 9 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0, 1, 0.0392157, 1 )
shape = SubResource( 10 )
[node name="StaticBody2D" type="StaticBody2D" parent="." index="2"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" index="0"]
shape = SubResource( 11 )

View File

@ -12,7 +12,6 @@ script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"] [node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = ExtResource( 3 ) frames = ExtResource( 3 )
frame = 1
playing = true playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"] [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2] [ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
@ -7,6 +7,7 @@
[ext_resource path="res://src/Interactables/HealthPickup.tscn" type="PackedScene" id=5] [ext_resource path="res://src/Interactables/HealthPickup.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6] [ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6]
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7] [ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
[ext_resource path="res://src/Interactables/Door.tscn" type="PackedScene" id=8]
[node name="Level" type="Node2D"] [node name="Level" type="Node2D"]
@ -82,3 +83,6 @@ position = Vector2( 319, 112 )
[node name="Chest" parent="." instance=ExtResource( 4 )] [node name="Chest" parent="." instance=ExtResource( 4 )]
position = Vector2( 187, 144 ) position = Vector2( 187, 144 )
[node name="Door" parent="." instance=ExtResource( 8 )]
position = Vector2( 866, 120 )