diff --git a/assets/mmz1_door.png b/assets/mmz1_door.png new file mode 100644 index 0000000..dcc5b12 Binary files /dev/null and b/assets/mmz1_door.png differ diff --git a/assets/mmz1_door.png.import b/assets/mmz1_door.png.import new file mode 100644 index 0000000..9cc3afe --- /dev/null +++ b/assets/mmz1_door.png.import @@ -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 diff --git a/src/Interactables/Door.gd b/src/Interactables/Door.gd new file mode 100644 index 0000000..684e18d --- /dev/null +++ b/src/Interactables/Door.gd @@ -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 + diff --git a/src/Interactables/Door.tscn b/src/Interactables/Door.tscn new file mode 100644 index 0000000..33df49b --- /dev/null +++ b/src/Interactables/Door.tscn @@ -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 ) diff --git a/src/Interactables/HealthPickup.tscn b/src/Interactables/HealthPickup.tscn index a60ecf9..8486a71 100644 --- a/src/Interactables/HealthPickup.tscn +++ b/src/Interactables/HealthPickup.tscn @@ -12,7 +12,6 @@ script = ExtResource( 1 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"] frames = ExtResource( 3 ) -frame = 1 playing = true [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"] diff --git a/src/Levels/Level.tscn b/src/Levels/Level.tscn index e1a16af..12111d1 100644 --- a/src/Levels/Level.tscn +++ b/src/Levels/Level.tscn @@ -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://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://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/Interactables/Door.tscn" type="PackedScene" id=8] [node name="Level" type="Node2D"] @@ -82,3 +83,6 @@ position = Vector2( 319, 112 ) [node name="Chest" parent="." instance=ExtResource( 4 )] position = Vector2( 187, 144 ) + +[node name="Door" parent="." instance=ExtResource( 8 )] +position = Vector2( 866, 120 )