Added basic elevator system

This commit is contained in:
2020-06-01 01:58:19 -04:00
parent ac1c935ca0
commit 1980139acb
36 changed files with 657 additions and 56 deletions

View File

@ -5,31 +5,28 @@
[ext_resource path="res://Scripts/Entities/Door.gd" type="Script" id=3]
[ext_resource path="res://Assets/Art/32x32mask.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=7]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16.0007, 15.9043 )
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="OccluderPolygon2D" id=8]
polygon = PoolVector2Array( -5, 18, -5, 0, -2, 0, -2, 4, 2, 4, 2, 0, 5, 0, 5, 18 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="OccluderPolygon2D" id=3]
polygon = PoolVector2Array( -5, 18, -5, 0, -2, 0, -2, 4, 2, 4, 2, 0, 5, 0, 5, 18 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 0, 32, 32, 32 )
[sub_resource type="AtlasTexture" id=3]
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 1 )
region = Rect2( 0, 64, 32, 32 )
[sub_resource type="OccluderPolygon2D" id=9]
[sub_resource type="OccluderPolygon2D" id=6]
polygon = PoolVector2Array( 5, -18, 5, 0, -5, 0, -5, -18 )
[sub_resource type="Animation" id=5]
resource_name = "Close"
[sub_resource type="Animation" id=7]
length = 0.5
tracks/0/type = "bezier"
tracks/0/path = NodePath("Top:position:x")
@ -92,8 +89,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0, 0.5 )
}
[sub_resource type="Animation" id=4]
resource_name = "Open"
[sub_resource type="Animation" id=8]
length = 0.5
tracks/0/type = "bezier"
tracks/0/path = NodePath("Bottom:position:x")
@ -156,7 +152,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0, 0.5 )
}
[sub_resource type="RectangleShape2D" id=6]
[sub_resource type="RectangleShape2D" id=9]
extents = Vector2( 40.2987, 16.0621 )
[node name="Door" type="Area2D"]
@ -165,31 +161,31 @@ script = ExtResource( 3 )
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource( 7 )
shape = SubResource( 1 )
[node name="Bottom" type="Sprite" parent="."]
z_index = 25
texture = SubResource( 1 )
texture = SubResource( 2 )
[node name="LightOccluder2D" type="LightOccluder2D" parent="Bottom"]
occluder = SubResource( 8 )
occluder = SubResource( 3 )
[node name="Top" type="Sprite" parent="."]
z_index = 25
texture = SubResource( 2 )
texture = SubResource( 4 )
[node name="Color" type="Sprite" parent="Top"]
texture = SubResource( 3 )
texture = SubResource( 5 )
[node name="LightOccluder2D" type="LightOccluder2D" parent="Top"]
occluder = SubResource( 9 )
occluder = SubResource( 6 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Close = SubResource( 5 )
anims/Open = SubResource( 4 )
anims/Close = SubResource( 7 )
anims/Open = SubResource( 8 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 6 )
shape = SubResource( 9 )
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 2 )

View File

@ -0,0 +1,42 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Assets/Art/Objects/elevator/elevator.png" type="Texture" id=1]
[ext_resource path="res://Scripts/Entities/Elevator.gd" type="Script" id=2]
[ext_resource path="res://Scripts/Component/ElevatorControls.gd" type="Script" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 2 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 16 )
[node name="Elevator" type="Node2D"]
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true
}
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="Bottom" type="StaticBody2D" parent="."]
position = Vector2( 0, 18 )
collision_layer = 2
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bottom"]
shape = SubResource( 1 )
[node name="Top" type="StaticBody2D" parent="."]
position = Vector2( 0, -18 )
collision_layer = 2
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Top"]
shape = SubResource( 1 )
[node name="ElevatorControls" type="Area2D" parent="."]
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="ElevatorControls"]
shape = SubResource( 2 )

View File

@ -0,0 +1,67 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Assets/Art/Objects/elevator/elevator-button-color.png" type="Texture" id=1]
[ext_resource path="res://Scripts/Entities/ElevatorButton.gd" type="Script" id=2]
[ext_resource path="res://Assets/Art/Objects/elevator/elevator-button.png" type="Texture" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 16, 8 )
[sub_resource type="CircleShape2D" id=2]
radius = 16.0
[sub_resource type="Animation" id=3]
resource_name = "Done"
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 1 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Waiting"
length = 0.4
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 1, 0 ]
}
[node name="ElevatorButton" type="Area2D"]
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true
}
[node name="Sprite" type="Sprite" parent="."]
texture = SubResource( 1 )
hframes = 2
frame = 1
[node name="Color" type="Sprite" parent="."]
modulate = Color( 0.0941176, 1, 0.14902, 1 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Done = SubResource( 3 )
anims/Waiting = SubResource( 4 )

View File

@ -0,0 +1,174 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://Assets/Art/Objects/elevator/elevator-door.png" type="Texture" id=1]
[ext_resource path="res://Assets/Sfx/door.wav" type="AudioStream" id=2]
[ext_resource path="res://Scripts/Entities/ElevatorDoor.gd" type="Script" id=3]
[ext_resource path="res://Assets/Art/32x32mask.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 1.65761, 15.9043 )
[sub_resource type="Animation" id=7]
length = 0.3
tracks/0/type = "bezier"
tracks/0/path = NodePath("Top:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/1/type = "bezier"
tracks/1/path = NodePath("Top:position:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"points": PoolRealArray( -24, -0.25, 0, 0.25, 0, -8, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/2/type = "bezier"
tracks/2/path = NodePath("Top:rotation_degrees")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/3/type = "bezier"
tracks/3/path = NodePath("Bottom:position:x")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/4/type = "bezier"
tracks/4/path = NodePath("Bottom:position:y")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"points": PoolRealArray( 24, -0.25, 0, 0.25, 0, 8, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/5/type = "bezier"
tracks/5/path = NodePath("Bottom:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
[sub_resource type="Animation" id=8]
length = 0.3
tracks/0/type = "bezier"
tracks/0/path = NodePath("Bottom:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/1/type = "bezier"
tracks/1/path = NodePath("Bottom:position:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"points": PoolRealArray( 8, -0.25, 0, 0.25, 0, 24, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/2/type = "bezier"
tracks/2/path = NodePath("Bottom:rotation_degrees")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/3/type = "bezier"
tracks/3/path = NodePath("Top:position:x")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/4/type = "bezier"
tracks/4/path = NodePath("Top:position:y")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"points": PoolRealArray( -8, -0.25, 0, 0.25, 0, -24, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
tracks/5/type = "bezier"
tracks/5/path = NodePath("Top:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0 ),
"times": PoolRealArray( 0, 0.3 )
}
[sub_resource type="RectangleShape2D" id=9]
extents = Vector2( 14.4443, 16.0621 )
[node name="ElevatorDoor" type="Area2D"]
script = ExtResource( 3 )
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource( 1 )
[node name="Bottom" type="Sprite" parent="."]
position = Vector2( 0, 8 )
scale = Vector2( 1, -1 )
z_index = 25
texture = ExtResource( 1 )
[node name="Top" type="Sprite" parent="."]
position = Vector2( 0, -8 )
z_index = 25
texture = ExtResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Close = SubResource( 7 )
anims/Open = SubResource( 8 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 9 )
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 2 )
bus = "Sfx"
[node name="Mask" type="Light2D" parent="."]
enabled = false
texture = ExtResource( 5 )
mode = 3
range_item_cull_mask = 2

View File

@ -20,6 +20,7 @@ font_data = ExtResource( 5 )
script = ExtResource( 2 )
[node name="Dialog" type="Control" parent="."]
visible = false
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
@ -99,6 +100,7 @@ margin_bottom = 31.0
text = "Choice"
[node name="ZoneLabel" type="Label" parent="."]
visible = false
anchor_top = 1.0
anchor_bottom = 1.0
margin_left = 12.0
@ -113,6 +115,7 @@ __meta__ = {
}
[node name="Tip" type="Label" parent="."]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -139,3 +142,30 @@ __meta__ = {
"_edit_use_anchors_": false
}
start_with_fade_in = false
[node name="ElevatorDialog" type="WindowDialog" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -125.5
margin_top = -132.0
margin_right = 125.5
margin_bottom = 132.0
theme = ExtResource( 1 )
window_title = "Elevator"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Buttons" type="VBoxContainer" parent="ElevatorDialog"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 6.0
margin_top = 6.0
margin_right = -6.0
margin_bottom = -6.0
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -1801,6 +1801,8 @@ atlas = ExtResource( 2 )
region = Rect2( 3, 19, 1, 2 )
[node name="Player" type="KinematicBody2D"]
collision_layer = 3
collision_mask = 3
script = ExtResource( 4 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@ -5,8 +5,6 @@
[ext_resource path="res://Scripts/Component/LightLoader.gd" type="Script" id=3]
[ext_resource path="res://Scripts/Entities/Wall Light.gd" type="Script" id=4]
[sub_resource type="CircleShape2D" id=1]
radius = 200.0