diff --git a/Scripts/CameraFollow.gd b/Scripts/CameraFollow.gd index dd45a5a..00ece2f 100644 --- a/Scripts/CameraFollow.gd +++ b/Scripts/CameraFollow.gd @@ -13,5 +13,9 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. onready var target = get_node("../FG/Player") +onready var covers = get_node("../FG/Covers") + + func _process (delta): position = target.position + diff --git a/Scripts/CoverControl.gd b/Scripts/CoverControl.gd index 22a8ea5..1667877 100644 --- a/Scripts/CoverControl.gd +++ b/Scripts/CoverControl.gd @@ -1,27 +1,88 @@ extends Node2D onready var player = get_node("../Player") +onready var covers = get_node("../Covers") +onready var furniture = get_node("../Furniture") # Declare member variables here. Examples: -# var a = 2 -# var b = "text" +var areamap = {'living':[0], 'bedtop':[1,2], 'bedtopmid':[2,3], 'bedbotmid':[3,4], 'bedbot':[4,5]} + +func hide_cover(xs): + for x in xs: + var cover = covers.get_child(x) + cover.hide() + +func show_cover(xs): + for x in xs: + var cover = covers.get_child(x) + cover.show() # Called when the node enters the scene tree for the first time. func _ready(): - var covers = get_node("../Covers") covers.show() - + for i in furniture.get_child_count(): + furniture.get_child(i).hide() + # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - for i in range(5): - var room = get_child(i) - var furniture = get_node("../Furniture").get_child(i) - var cover = get_node("../Covers").get_child(i) - if(room.overlaps_body(player)): - furniture.show() - cover.hide() - else: - furniture.hide() - cover.show() + pass + +func _on_Living_body_entered(body): + if body == player: + hide_cover(areamap['living']) + furniture.get_node("Living").show() + + +func _on_Living_body_exited(body): + if body == player: + show_cover(areamap['living']) + furniture.get_node("Living").hide() + + +func _on_BedTop_body_entered(body): + if body == player: + hide_cover(areamap['bedtop']) + furniture.get_node("BedTop").show() + + +func _on_BedTop_body_exited(body): + if body == player: + show_cover(areamap['bedtop']) + furniture.get_node("BedTop").hide() + + +func _on_BedTopMid_body_entered(body): + if body == player: + hide_cover(areamap['bedtopmid']) + furniture.get_node("BedTopMid").show() + + +func _on_BedTopMid_body_exited(body): + if body == player: + show_cover(areamap['bedtopmid']) + furniture.get_node("BedTopMid").hide() + + +func _on_BedBotMid_body_entered(body): + if body == player: + hide_cover(areamap['bedbotmid']) + furniture.get_node("BedBotMid").show() + + +func _on_BedBotMid_body_exited(body): + if body == player: + show_cover(areamap['bedbotmid']) + furniture.get_node("BedBotMid").hide() + + +func _on_BedBot_body_entered(body): + if body == player: + hide_cover(areamap['bedbot']) + furniture.get_node("BedBot").show() + +func _on_BedBot_body_exited(body): + if body == player: + show_cover(areamap['bedbot']) + furniture.get_node("BedBot").hide() diff --git a/Sprites/josep/Josep.tscn b/Sprites/josep/Josep.tscn new file mode 100644 index 0000000..521c010 --- /dev/null +++ b/Sprites/josep/Josep.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Sprites/josep/front.png" type="Texture" id=1] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 25.0 +height = 0.0 + +[node name="Josep" type="StaticBody2D"] + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, 35 ) +shape = SubResource( 1 ) diff --git a/Story/Ch1S2.tscn b/Story/Ch1S2.tscn index 95b448f..c06861a 100644 --- a/Story/Ch1S2.tscn +++ b/Story/Ch1S2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://Resources/lodge.tres" type="TileSet" id=1] [ext_resource path="res://Sprites/sak/Sak.tscn" type="PackedScene" id=2] @@ -15,11 +15,13 @@ [ext_resource path="res://Scenes/InteractiveDialog.tscn" type="PackedScene" id=13] [ext_resource path="res://Scripts/CoverControl.gd" type="Script" id=14] [ext_resource path="res://Music/Lodge-Unmastered.mp3" type="AudioStream" id=15] +[ext_resource path="res://Sprites/josep/Josep.tscn" type="PackedScene" id=16] [node name="Ch1S2" type="Node2D"] [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = ExtResource( 15 ) +autoplay = true [node name="CanvasLayer" type="CanvasLayer" parent="."] @@ -67,9 +69,10 @@ format = 1 tile_data = PoolIntArray( 262136, 36, 0, 262137, 37, 0, 262138, 37, 0, 262139, 38, 0, 196628, 36, 0, 196629, 37, 0, 196630, 37, 0, 196631, 38, 0, 327672, 42, 0, 327673, 43, 0, 327674, 43, 0, 327675, 44, 0, 262145, 36, 0, 262146, 37, 0, 262147, 37, 0, 262148, 37, 0, 262149, 37, 0, 262150, 38, 0, 262164, 42, 0, 262165, 43, 0, 262166, 43, 0, 262167, 44, 0, 327681, 39, 0, 327682, 40, 0, 327683, 40, 0, 327684, 40, 0, 327685, 40, 0, 327686, 41, 0, 393217, 42, 0, 393218, 43, 0, 393219, 43, 0, 393220, 43, 0, 393221, 43, 0, 393222, 44, 0, 524280, 36, 0, 524281, 37, 0, 524282, 37, 0, 524283, 38, 0, 458772, 36, 0, 458773, 37, 0, 458774, 37, 0, 458775, 38, 0, 589816, 42, 0, 589817, 43, 0, 589818, 43, 0, 589819, 44, 0, 524308, 42, 0, 524309, 43, 0, 524310, 43, 0, 524311, 44, 0, 786424, 36, 0, 786425, 37, 0, 786426, 37, 0, 786427, 38, 0, 720916, 36, 0, 720917, 37, 0, 720918, 37, 0, 720919, 38, 0, 851960, 42, 0, 851961, 43, 0, 851962, 43, 0, 851963, 44, 0, 786452, 42, 0, 786453, 43, 0, 786454, 43, 0, 786455, 44, 0, 1048568, 36, 0, 1048569, 37, 0, 1048570, 37, 0, 1048571, 38, 0, 983060, 36, 0, 983061, 37, 0, 983062, 37, 0, 983063, 38, 0, 1114104, 42, 0, 1114105, 43, 0, 1114106, 43, 0, 1114107, 44, 0, 1048596, 42, 0, 1048597, 43, 0, 1048598, 43, 0, 1048599, 44, 0 ) [node name="FG" type="YSort" parent="."] +z_index = 1 [node name="Player" parent="FG" instance=ExtResource( 10 )] -position = Vector2( 468, 297 ) +position = Vector2( 285, 171 ) [node name="Furniture" type="YSort" parent="FG"] z_index = 1 @@ -103,8 +106,6 @@ position = Vector2( 580, 155 ) texture = ExtResource( 5 ) [node name="BedTop" type="TileMap" parent="FG/Furniture"] -visible = false -z_index = 1 tile_set = ExtResource( 1 ) cell_size = Vector2( 30, 30 ) cell_y_sort = true @@ -114,7 +115,6 @@ tile_data = PoolIntArray( 262128, 69, 0, 262130, 65, 0, 196648, 536870977, 0, 19 [node name="BedTopMid" type="TileMap" parent="FG/Furniture"] visible = false -z_index = 1 tile_set = ExtResource( 1 ) cell_size = Vector2( 30, 30 ) cell_y_sort = true @@ -123,7 +123,6 @@ tile_data = PoolIntArray( 458736, 68, 0, 393256, 536870980, 0, 589808, 68, 0, 52 [node name="BedBotMid" type="TileMap" parent="FG/Furniture"] visible = false -z_index = 1 tile_set = ExtResource( 1 ) cell_size = Vector2( 30, 30 ) cell_tile_origin = 2 @@ -133,7 +132,6 @@ tile_data = PoolIntArray( 983024, 536870980, 0, 917544, 68, 0, 1114096, 53687098 [node name="BedBot" type="TileMap" parent="FG/Furniture"] visible = false -z_index = 1 tile_set = ExtResource( 1 ) cell_size = Vector2( 30, 30 ) cell_y_sort = true @@ -141,6 +139,7 @@ format = 1 tile_data = PoolIntArray( 1507312, 68, 0, 1441832, 536870980, 0, 1638384, 68, 0, 1572904, 536870980, 0, 1769456, 67, 0, 1703976, 536870979, 0, 1834992, 69, 0, 1834994, 65, 0, 1769512, 536870977, 0, 1769518, 536870981, 0, 2228208, 74, 0, 2162733, 536870986, 0 ) [node name="NPCs" type="YSort" parent="FG"] +z_index = 1 [node name="Richal" parent="FG/NPCs" instance=ExtResource( 11 )] position = Vector2( 600, 180 ) @@ -197,6 +196,9 @@ timeline = "timeline-1642498159.json" [node name="CollisionShape2D" parent="FG/NPCs/Alistair/Node2D/Area2D" index="0"] position = Vector2( 0, 18 ) +[node name="Josep" parent="FG/NPCs" instance=ExtResource( 16 )] +position = Vector2( -372, 987 ) + [node name="Floating" type="TileMap" parent="FG"] z_index = 1 tile_set = ExtResource( 1 ) @@ -207,7 +209,7 @@ tile_data = PoolIntArray( 458755, 52, 0 ) [node name="Covers" type="Node2D" parent="FG"] visible = false -z_index = 1 +z_index = 2 [node name="Living" type="TileMap" parent="FG/Covers"] tile_set = ExtResource( 1 ) @@ -215,29 +217,36 @@ cell_size = Vector2( 60, 60 ) format = 1 tile_data = PoolIntArray( -4, 61, 0, -65536, 61, 0, -65532, 61, 0, -65528, 61, 0, -65524, 61, 0, -65520, 61, 0, 262140, 61, 0, 196608, 61, 0, 196612, 61, 0, 196616, 61, 0, 196620, 61, 0, 196624, 61, 0, 262144, 61, 0, 262148, 61, 0, 262152, 61, 0, 262156, 61, 0, 524284, 61, 0, 458768, 61, 0, 786428, 61, 0, 720912, 61, 0, 1048572, 61, 0, 983056, 61, 0 ) +[node name="TopWall" type="TileMap" parent="FG/Covers"] +z_index = -1 +tile_set = ExtResource( 1 ) +cell_size = Vector2( 60, 60 ) +format = 1 +tile_data = PoolIntArray( -8, 61, 0, -65516, 61, 0 ) + [node name="BedTop" type="TileMap" parent="FG/Covers"] -z_as_relative = false +z_index = -1 tile_set = ExtResource( 1 ) cell_size = Vector2( 60, 60 ) format = 1 -tile_data = PoolIntArray( -8, 61, 0, -65516, 61, 0, 262136, 61, 0, 196628, 61, 0 ) +tile_data = PoolIntArray( 262136, 61, 0, 196628, 61, 0 ) [node name="BedTopMid" type="TileMap" parent="FG/Covers"] -z_as_relative = false +z_index = -1 tile_set = ExtResource( 1 ) cell_size = Vector2( 60, 60 ) format = 1 tile_data = PoolIntArray( 524280, 61, 0, 458772, 61, 0 ) [node name="BedBotMid" type="TileMap" parent="FG/Covers"] -z_as_relative = false +z_index = -1 tile_set = ExtResource( 1 ) cell_size = Vector2( 60, 60 ) format = 1 tile_data = PoolIntArray( 786424, 61, 0, 720916, 61, 0 ) [node name="BedBot" type="TileMap" parent="FG/Covers"] -z_as_relative = false +z_index = -1 tile_set = ExtResource( 1 ) cell_size = Vector2( 60, 60 ) format = 1 @@ -250,47 +259,58 @@ script = ExtResource( 14 ) [node name="Living" type="Area2D" parent="FG/CoverControl"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="FG/CoverControl/Living"] -polygon = PoolVector2Array( -231, 180, 1191, 180, 1191, 1140, 960, 1140, 960, 480, 0, 480, 0, 1140, -231, 1140 ) +polygon = PoolVector2Array( -216, 180, 1176, 180, 1176, 1140, 960, 1140, 960, 480, 0, 480, 0, 1140, -216, 1140 ) [node name="BedTop" type="Area2D" parent="FG/CoverControl"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="FG/CoverControl/BedTop"] position = Vector2( -129, 0 ) -polygon = PoolVector2Array( -351, 180, -144, 180, -144, 420, -351, 420 ) +polygon = PoolVector2Array( -351, 180, -135, 180, -135, 420, -351, 420 ) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="FG/CoverControl/BedTop"] position = Vector2( 120, 0 ) -polygon = PoolVector2Array( 1113, 180, 1320, 180, 1320, 420, 1113, 420 ) +polygon = PoolVector2Array( 1104, 180, 1320, 180, 1320, 420, 1104, 420 ) [node name="BedTopMid" type="Area2D" parent="FG/CoverControl"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="FG/CoverControl/BedTopMid"] position = Vector2( -120, 0 ) -polygon = PoolVector2Array( -360, 420, -153, 420, -153, 660, -360, 660 ) +polygon = PoolVector2Array( -360, 420, -144, 420, -144, 660, -360, 660 ) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="FG/CoverControl/BedTopMid"] position = Vector2( 120, 0 ) -polygon = PoolVector2Array( 1113, 420, 1113, 660, 1320, 660, 1320, 420 ) +polygon = PoolVector2Array( 1104, 420, 1104, 660, 1320, 660, 1320, 420 ) [node name="BedBotMid" type="Area2D" parent="FG/CoverControl"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="FG/CoverControl/BedBotMid"] position = Vector2( -120, 0 ) -polygon = PoolVector2Array( -360, 660, -360, 900, -153, 900, -153, 660 ) +polygon = PoolVector2Array( -360, 660, -360, 900, -144, 900, -144, 660 ) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="FG/CoverControl/BedBotMid"] position = Vector2( 120, 0 ) -polygon = PoolVector2Array( 1113, 660, 1113, 900, 1320, 900, 1320, 660 ) +polygon = PoolVector2Array( 1104, 660, 1104, 900, 1320, 900, 1320, 660 ) [node name="BedBot" type="Area2D" parent="FG/CoverControl"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="FG/CoverControl/BedBot"] position = Vector2( -120, 0 ) -polygon = PoolVector2Array( -360, 900, -360, 1140, -153, 1137, -153, 900 ) +polygon = PoolVector2Array( -360, 900, -360, 1140, -144, 1140, -144, 900 ) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="FG/CoverControl/BedBot"] position = Vector2( 120, 0 ) -polygon = PoolVector2Array( 1113, 900, 1113, 1140, 1320, 1140, 1320, 900 ) +polygon = PoolVector2Array( 1104, 900, 1104, 1140, 1320, 1140, 1320, 900 ) + +[connection signal="body_entered" from="FG/CoverControl/Living" to="FG/CoverControl" method="_on_Living_body_entered"] +[connection signal="body_exited" from="FG/CoverControl/Living" to="FG/CoverControl" method="_on_Living_body_exited"] +[connection signal="body_entered" from="FG/CoverControl/BedTop" to="FG/CoverControl" method="_on_BedTop_body_entered"] +[connection signal="body_exited" from="FG/CoverControl/BedTop" to="FG/CoverControl" method="_on_BedTop_body_exited"] +[connection signal="body_entered" from="FG/CoverControl/BedTopMid" to="FG/CoverControl" method="_on_BedTopMid_body_entered"] +[connection signal="body_exited" from="FG/CoverControl/BedTopMid" to="FG/CoverControl" method="_on_BedTopMid_body_exited"] +[connection signal="body_entered" from="FG/CoverControl/BedBotMid" to="FG/CoverControl" method="_on_BedBotMid_body_entered"] +[connection signal="body_exited" from="FG/CoverControl/BedBotMid" to="FG/CoverControl" method="_on_BedBotMid_body_exited"] +[connection signal="body_entered" from="FG/CoverControl/BedBot" to="FG/CoverControl" method="_on_BedBot_body_entered"] +[connection signal="body_exited" from="FG/CoverControl/BedBot" to="FG/CoverControl" method="_on_BedBot_body_exited"] [editable path="FG/NPCs/Richal/Node2D"] [editable path="FG/NPCs/James/Node2D"]