Added basic elevator system
This commit is contained in:
parent
ac1c935ca0
commit
1980139acb
@ -0,0 +1,3 @@
|
||||
source_md5="ac15d19b18183939f2cb938b48b83391"
|
||||
dest_md5="0983b74d7b93c756eb0c5a98b4157abd"
|
||||
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="240c53764197402a0c89fe8fb8b2a878"
|
||||
dest_md5="de36b355f43d62393cda8f9c25ab30ad"
|
||||
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="a43d1da157f5981d7d307fa0f05c7144"
|
||||
dest_md5="de067c565a3ab4762ae06714e45fe0ae"
|
||||
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="3cacd4765fc525e57c7258a4805508e6"
|
||||
dest_md5="2dab7bdfa7f0fc281860167c39ed10b6"
|
||||
|
Binary file not shown.
BIN
client/Assets/Art/Objects/elevator/elevator-button-color.png
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator-button-color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 B |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/elevator-button-color.png-fe767a41ebb2e92445e76edbb2e18f7a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Art/Objects/elevator/elevator-button-color.png"
|
||||
dest_files=[ "res://.import/elevator-button-color.png-fe767a41ebb2e92445e76edbb2e18f7a.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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
client/Assets/Art/Objects/elevator/elevator-button.aseprite
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator-button.aseprite
Normal file
Binary file not shown.
BIN
client/Assets/Art/Objects/elevator/elevator-button.png
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator-button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 185 B |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/elevator-button.png-77644fd41dc75c8e32a225dd140c8b38.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Art/Objects/elevator/elevator-button.png"
|
||||
dest_files=[ "res://.import/elevator-button.png-77644fd41dc75c8e32a225dd140c8b38.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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
client/Assets/Art/Objects/elevator/elevator-door.aseprite
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator-door.aseprite
Normal file
Binary file not shown.
BIN
client/Assets/Art/Objects/elevator/elevator-door.png
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator-door.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
34
client/Assets/Art/Objects/elevator/elevator-door.png.import
Normal file
34
client/Assets/Art/Objects/elevator/elevator-door.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/elevator-door.png-c8a525f29a53c56da780c1ade7c02552.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Art/Objects/elevator/elevator-door.png"
|
||||
dest_files=[ "res://.import/elevator-door.png-c8a525f29a53c56da780c1ade7c02552.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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
client/Assets/Art/Objects/elevator/elevator.aseprite
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator.aseprite
Normal file
Binary file not shown.
BIN
client/Assets/Art/Objects/elevator/elevator.png
Normal file
BIN
client/Assets/Art/Objects/elevator/elevator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 316 B |
34
client/Assets/Art/Objects/elevator/elevator.png.import
Normal file
34
client/Assets/Art/Objects/elevator/elevator.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/elevator.png-6104b47e90854ba939097ca22c392814.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Art/Objects/elevator/elevator.png"
|
||||
dest_files=[ "res://.import/elevator.png-6104b47e90854ba939097ca22c392814.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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
@ -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 )
|
||||
|
42
client/Nodes/Elevator.tscn
Normal file
42
client/Nodes/Elevator.tscn
Normal 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 )
|
67
client/Nodes/ElevatorButton.tscn
Normal file
67
client/Nodes/ElevatorButton.tscn
Normal 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 )
|
174
client/Nodes/ElevatorDoor.tscn
Normal file
174
client/Nodes/ElevatorDoor.tscn
Normal 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
|
@ -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
|
||||
}
|
||||
|
@ -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="."]
|
||||
|
@ -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
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
4
client/Scripts/Component/ElevatorControls.gd
Normal file
4
client/Scripts/Component/ElevatorControls.gd
Normal file
@ -0,0 +1,4 @@
|
||||
extends "res://Scripts/Component/Interactable.gd"
|
||||
|
||||
func _ready():
|
||||
connect("interacted", get_parent(), "_on_interact")
|
@ -6,34 +6,43 @@ var opened = false
|
||||
export var locked = false
|
||||
export var security_level = 0
|
||||
var player_level = -1
|
||||
var color_node : Node2D
|
||||
|
||||
|
||||
|
||||
func lock():
|
||||
locked = true
|
||||
$Top/Color.modulate = Color.red
|
||||
if color_node:
|
||||
color_node.modulate = Color.red
|
||||
|
||||
func unlock():
|
||||
locked = false
|
||||
set_color()
|
||||
|
||||
func set_color():
|
||||
match(security_level):
|
||||
0:
|
||||
$Top/Color.modulate = Color.green
|
||||
1:
|
||||
$Top/Color.modulate = Color.blue
|
||||
2:
|
||||
$Top/Color.modulate = Color.yellow
|
||||
3:
|
||||
$Top/Color.modulate = Color.orange
|
||||
4:
|
||||
$Top/Color.modulate = Color.red
|
||||
5:
|
||||
$Top/Color.modulate = Color.purple
|
||||
if color_node:
|
||||
match(security_level):
|
||||
0:
|
||||
color_node.modulate = Color.green
|
||||
1:
|
||||
color_node.modulate = Color.blue
|
||||
2:
|
||||
color_node.modulate = Color.yellow
|
||||
3:
|
||||
color_node.modulate = Color.orange
|
||||
4:
|
||||
color_node.modulate = Color.red
|
||||
5:
|
||||
color_node.modulate = Color.purple
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
connect("body_entered", self, "_on_body_enter")
|
||||
connect("body_exited", self, "_on_body_exit")
|
||||
if $Top/Color:
|
||||
color_node = $Top/Color
|
||||
elif $Color:
|
||||
color_node = $Color
|
||||
if locked:
|
||||
lock()
|
||||
else:
|
||||
@ -60,6 +69,7 @@ func close():
|
||||
if opened:
|
||||
$AnimationPlayer.play("Close")
|
||||
$AudioStreamPlayer2D.play()
|
||||
|
||||
$StaticBody2D.collision_layer = 1
|
||||
$StaticBody2D.collision_mask = 1
|
||||
opened = false
|
||||
|
62
client/Scripts/Entities/Elevator.gd
Normal file
62
client/Scripts/Entities/Elevator.gd
Normal file
@ -0,0 +1,62 @@
|
||||
extends Node2D
|
||||
|
||||
signal elevator_stopped
|
||||
|
||||
export(Array, Vector2) var relative_positions = [Vector2(0,0)]
|
||||
export(Array, String) var labels = ["Default"]
|
||||
export(Array, NodePath) var doors = []
|
||||
export var current_pos : int = 0
|
||||
|
||||
var moving : bool = false
|
||||
|
||||
var gui
|
||||
var motion
|
||||
var intial_pos : Vector2
|
||||
export var elevator_speed = 25
|
||||
|
||||
func _ready():
|
||||
motion = Vector2.ZERO
|
||||
intial_pos = global_position
|
||||
|
||||
func _on_interact():
|
||||
if not moving:
|
||||
if not gui:
|
||||
gui = get_node("/root/World/GUI")
|
||||
gui.open_elevator_menu(self)
|
||||
|
||||
func _on_choice(index):
|
||||
start_moving(index)
|
||||
gui.close_elevator_menu()
|
||||
|
||||
func start_moving(index):
|
||||
if current_pos != index:
|
||||
moving = true
|
||||
current_pos = index
|
||||
|
||||
# Close all doors while in transit
|
||||
for door_path in doors:
|
||||
var door = get_node(door_path)
|
||||
door.close()
|
||||
door.lock()
|
||||
return true
|
||||
return false
|
||||
|
||||
func stop_moving():
|
||||
emit_signal("elevator_stopped")
|
||||
moving = false
|
||||
# Alert doors of updated elevator state
|
||||
for door_path in doors:
|
||||
get_node(door_path).on_elevator_stop(current_pos)
|
||||
|
||||
func _physics_process(delta):
|
||||
if moving:
|
||||
# Move towards elevator stop
|
||||
var target_pos = intial_pos + relative_positions[current_pos]
|
||||
var angle = get_angle_to(target_pos)
|
||||
var velocity = Vector2(cos(angle),sin(angle))
|
||||
global_position += velocity * elevator_speed * delta
|
||||
|
||||
# Stop when elevator is at destination
|
||||
if global_position.distance_to(target_pos) < 0.25:
|
||||
global_position = target_pos
|
||||
stop_moving()
|
20
client/Scripts/Entities/ElevatorButton.gd
Normal file
20
client/Scripts/Entities/ElevatorButton.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends "res://Scripts/Component/Interactable.gd"
|
||||
|
||||
export(NodePath) var elevator
|
||||
export var call_to_index : int = 0
|
||||
|
||||
var elevator_node
|
||||
|
||||
func _ready():
|
||||
elevator_node = get_node(elevator)
|
||||
connect("interacted", self, "_on_interact")
|
||||
$AnimationPlayer.play("Done")
|
||||
|
||||
func _on_interact():
|
||||
if elevator_node.start_moving(call_to_index):
|
||||
elevator_node.connect("elevator_stopped", self, "_on_finish")
|
||||
$AnimationPlayer.play("Waiting")
|
||||
|
||||
func _on_finish():
|
||||
elevator_node.disconnect("elevator_stopped", self, "_on_finish")
|
||||
$AnimationPlayer.play("Done")
|
10
client/Scripts/Entities/ElevatorDoor.gd
Normal file
10
client/Scripts/Entities/ElevatorDoor.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends "res://Scripts/Entities/Door.gd"
|
||||
|
||||
export var level_index : int = 0
|
||||
|
||||
func on_elevator_stop(index):
|
||||
if index == level_index:
|
||||
unlock()
|
||||
open()
|
||||
else:
|
||||
lock()
|
@ -139,17 +139,17 @@ func user_input():
|
||||
# Interactions
|
||||
if Input.is_action_just_pressed("interact") and len(interactables) > 0 and not gui.is_in_dialog():
|
||||
interact()
|
||||
|
||||
# Move down platforms
|
||||
if is_on_floor() and Input.is_action_just_pressed("ui_up") and Input.is_action_pressed("ui_down"):
|
||||
var test_pos = Vector2(position.x,position.y+6)
|
||||
if not test_move(Transform2D(0,test_pos), Vector2(0,1)):
|
||||
position.y = position.y + 2
|
||||
return
|
||||
|
||||
|
||||
# Jumping
|
||||
if(test_move(transform, Vector2(0,1)) and Input.is_action_just_pressed("ui_up")):
|
||||
jumped = true
|
||||
if Input.is_action_just_pressed("ui_up"):
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
if is_on_floor():
|
||||
var test_pos = Vector2(position.x,position.y+6)
|
||||
if not test_move(Transform2D(0,test_pos), Vector2(0,1)):
|
||||
position.y = position.y + 2
|
||||
return
|
||||
elif(test_move(transform, Vector2(0,1))):
|
||||
jumped = true
|
||||
|
||||
# Move left and right <- & ->
|
||||
# - - - - - - - - - - - - - - -
|
||||
|
@ -1,7 +1,9 @@
|
||||
extends Sprite
|
||||
|
||||
export var shadows : bool = false
|
||||
export var energy : float = 1.1
|
||||
|
||||
func _ready():
|
||||
$Light2D.show()
|
||||
$Light2D.shadow_enabled = shadows
|
||||
$Light2D.energy = energy
|
||||
|
@ -120,3 +120,20 @@ func fade_screen(seconds = 1, fade_in=true):
|
||||
|
||||
func _on_screen_fade_complete():
|
||||
emit_signal("screen_fade_complete")
|
||||
|
||||
func open_elevator_menu(elevator):
|
||||
for i in range($ElevatorDialog/Buttons.get_child_count()):
|
||||
$ElevatorDialog/Buttons.get_child(i).queue_free()
|
||||
|
||||
var num = 0
|
||||
for pos in elevator.relative_positions:
|
||||
var button = Button.new()
|
||||
button.text = elevator.labels[num]
|
||||
button.connect("button_down", elevator, "_on_choice", [num])
|
||||
$ElevatorDialog/Buttons.add_child(button)
|
||||
num = num + 1
|
||||
|
||||
$ElevatorDialog.popup_centered()
|
||||
|
||||
func close_elevator_menu():
|
||||
$ElevatorDialog.hide()
|
||||
|
Loading…
Reference in New Issue
Block a user