Beginning of lesson 33. House polygon working and we are able to speak with NPC at world map, but not in starter town.
This commit is contained in:
parent
ffbbfd455e
commit
b0c7c3d3ff
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=22 format=3 uid="uid://d3e5mg0gk8u7r"]
|
[gd_scene load_steps=23 format=3 uid="uid://d3e5mg0gk8u7r"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://byx166hd5b3as" path="res://gfx/game/maps/entities/player/Idle/Untitled-0_0.png" id="1_li2a0"]
|
[ext_resource type="Texture2D" uid="uid://byx166hd5b3as" path="res://gfx/game/maps/entities/player/Idle/Untitled-0_0.png" id="1_li2a0"]
|
||||||
[ext_resource type="Script" uid="uid://bo0had2vq4r7h" path="res://scripts/game/maps/entities/mob.gd" id="1_mu6cs"]
|
[ext_resource type="Script" uid="uid://bo0had2vq4r7h" path="res://scripts/game/maps/entities/mob.gd" id="1_mu6cs"]
|
||||||
|
|
@ -129,11 +129,15 @@ size = Vector2(4, 4)
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tvinw"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tvinw"]
|
||||||
size = Vector2(16, 16)
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
[node name="Mob" type="Node2D" node_paths=PackedStringArray("animator", "collisionRay_1", "collisionRay_2")]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_mu6cs"]
|
||||||
|
radius = 8.0
|
||||||
|
|
||||||
|
[node name="Mob" type="Node2D" node_paths=PackedStringArray("animator", "collisionRay_1", "collisionRay_2", "speechCollider")]
|
||||||
script = ExtResource("1_mu6cs")
|
script = ExtResource("1_mu6cs")
|
||||||
animator = NodePath("AnimatedSprite2D")
|
animator = NodePath("AnimatedSprite2D")
|
||||||
collisionRay_1 = NodePath("CollisionRayCast_1")
|
collisionRay_1 = NodePath("CollisionRayCast_1")
|
||||||
collisionRay_2 = NodePath("CollisionRayCast_2")
|
collisionRay_2 = NodePath("CollisionRayCast_2")
|
||||||
|
speechCollider = NodePath("SpeachRadius")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
position = Vector2(8, 8)
|
position = Vector2(8, 8)
|
||||||
|
|
@ -150,17 +154,25 @@ position = Vector2(8, 8)
|
||||||
target_position = Vector2(0, 16)
|
target_position = Vector2(0, 16)
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="MapTriggerCollider" type="Area2D" parent="."]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="MapTriggerCollider"]
|
||||||
position = Vector2(8, 8)
|
position = Vector2(8, 8)
|
||||||
shape = SubResource("RectangleShape2D_mu6cs")
|
shape = SubResource("RectangleShape2D_mu6cs")
|
||||||
|
|
||||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
[node name="Collider" type="RigidBody2D" parent="."]
|
||||||
collision_layer = 6
|
collision_layer = 6
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
freeze = true
|
freeze = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collider"]
|
||||||
position = Vector2(8, 8)
|
position = Vector2(8, 8)
|
||||||
shape = SubResource("RectangleShape2D_tvinw")
|
shape = SubResource("RectangleShape2D_tvinw")
|
||||||
|
|
||||||
|
[node name="SpeachRadius" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="SpeachRadius"]
|
||||||
|
position = Vector2(8, 8)
|
||||||
|
shape = SubResource("CircleShape2D_mu6cs")
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,142 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://bpsrg5d3gncnd"]
|
[gd_scene load_steps=21 format=3 uid="uid://bpsrg5d3gncnd"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://d3e5mg0gk8u7r" path="res://scenes/game/maps/entities/mob.tscn" id="1_7y2qh"]
|
[ext_resource type="PackedScene" uid="uid://d3e5mg0gk8u7r" path="res://scenes/game/maps/entities/mob.tscn" id="1_7y2qh"]
|
||||||
[ext_resource type="Script" uid="uid://dsguwthn2datq" path="res://scripts/game/maps/entities/Player.gd" id="2_us7jc"]
|
[ext_resource type="Script" uid="uid://dsguwthn2datq" path="res://scripts/game/maps/entities/Player.gd" id="2_us7jc"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://byx166hd5b3as" path="res://gfx/game/maps/entities/player/Idle/Untitled-0_0.png" id="3_eoasd"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://gm5dhmls0klm" path="res://gfx/game/maps/entities/player/WalkLeft/Untitled-3_0.png" id="4_k00a3"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cio1xyswbao5j" path="res://gfx/game/maps/entities/player/WalkRight/Untitled-3_0.png" id="5_gge1o"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://svg30tifp74r" path="res://gfx/game/maps/entities/player/WalkUp/Untitled-2_0.png" id="6_v7ihw"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://puqpn3m0ejv1" path="res://gfx/game/maps/entities/player/WalkDown/Untitled-2_0.png" id="7_is0ql"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bel7ltrdmhvx3" path="res://gfx/game/maps/entities/player/WalkDown/Untitled-2_1.png" id="8_dohvn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bvallk0cswtnq" path="res://gfx/game/maps/entities/player/WalkDown/Untitled-2_2.png" id="9_eaely"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b4ptv7ts0nlhu" path="res://gfx/game/maps/entities/player/WalkDown/Untitled-2_3.png" id="10_m3m4g"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ddw1m0c2pby4c" path="res://gfx/game/maps/entities/player/WalkLeft/Untitled-3_1.png" id="11_uyvca"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://brsuvqye8vfji" path="res://gfx/game/maps/entities/player/WalkLeft/Untitled-3_2.png" id="12_abfb4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cnnbbvgvnprqv" path="res://gfx/game/maps/entities/player/WalkLeft/Untitled-3_3.png" id="13_n3xhi"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://by38ifhhoq0iv" path="res://gfx/game/maps/entities/player/WalkRight/Untitled-3_1.png" id="14_7vmje"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cooxpasywe0a6" path="res://gfx/game/maps/entities/player/WalkRight/Untitled-3_2.png" id="15_ukkhw"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://byqc5gd0r2ija" path="res://gfx/game/maps/entities/player/WalkRight/Untitled-3_3.png" id="16_2rl3s"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://vu0jihe8b75u" path="res://gfx/game/maps/entities/player/WalkUp/Untitled-2_1.png" id="17_5okdn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cpw3bdg07t8s7" path="res://gfx/game/maps/entities/player/WalkUp/Untitled-2_2.png" id="18_pledg"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b2068kd1mmpsh" path="res://gfx/game/maps/entities/player/WalkUp/Untitled-2_3.png" id="19_y2pg7"]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_wyylp"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("3_eoasd")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Idle Down",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_k00a3")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Idle Left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_gge1o")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Idle Right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("6_v7ihw")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Idle Up",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("7_is0ql")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("8_dohvn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("9_eaely")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("10_m3m4g")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Walk Down",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("4_k00a3")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("11_uyvca")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("12_abfb4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("13_n3xhi")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Walk Left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("5_gge1o")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("14_7vmje")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("15_ukkhw")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("16_2rl3s")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Walk Right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("6_v7ihw")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("17_5okdn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("18_pledg")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("19_y2pg7")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Walk Up",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
[node name="Player" node_paths=PackedStringArray("camera") instance=ExtResource("1_7y2qh")]
|
[node name="Player" node_paths=PackedStringArray("camera") instance=ExtResource("1_7y2qh")]
|
||||||
script = ExtResource("2_us7jc")
|
script = ExtResource("2_us7jc")
|
||||||
camera = NodePath("Camera2D")
|
camera = NodePath("Camera2D")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" parent="." index="0"]
|
||||||
|
sprite_frames = SubResource("SpriteFrames_wyylp")
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="." index="3"]
|
[node name="Camera2D" type="Camera2D" parent="." index="3"]
|
||||||
zoom = Vector2(2, 2)
|
zoom = Vector2(2, 2)
|
||||||
|
|
||||||
|
[node name="MapTriggerCollider" parent="." index="4"]
|
||||||
|
collision_layer = 3
|
||||||
|
|
||||||
|
[node name="SpeachRadius" parent="." index="6"]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 4
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://864h4oam7qfk"]
|
[gd_scene load_steps=2 format=3 uid="uid://864h4oam7qfk"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c50fmagffbdas" path="res://scripts/game/maps/entities/ToggleRoofTrigger.gd" id="1_58sfy"]
|
[ext_resource type="Script" uid="uid://c50fmagffbdas" path="res://scripts/game/maps/entities/ToggleRoofTrigger.gd" id="1_58sfy"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_58sfy"]
|
|
||||||
size = Vector2(48, 16)
|
|
||||||
|
|
||||||
[node name="ToggleRoofTrigger" type="Area2D"]
|
[node name="ToggleRoofTrigger" type="Area2D"]
|
||||||
script = ExtResource("1_58sfy")
|
script = ExtResource("1_58sfy")
|
||||||
metadata/_custom_type_script = "uid://c50fmagffbdas"
|
metadata/_custom_type_script = "uid://c50fmagffbdas"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
|
||||||
position = Vector2(8, 8)
|
|
||||||
shape = SubResource("RectangleShape2D_58sfy")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,9 @@ metadata/_custom_type_script = "uid://dcg3hnc5yq61d"
|
||||||
position = Vector2(416, 304)
|
position = Vector2(416, 304)
|
||||||
layerName = "Starterhaus"
|
layerName = "Starterhaus"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="Entities/ToggleRoofTrigger" index="0"]
|
||||||
|
polygon = PackedVector2Array(16, 0, 16, 0, 32, 0, 32, 16, -16, 16, -16, 0, 0, 0, 0, -16, -64, -16, -64, -112, 96, -112, 96, -16, 16, -16)
|
||||||
|
|
||||||
[node name="Guard1" parent="Entities" instance=ExtResource("5_4hge2")]
|
[node name="Guard1" parent="Entities" instance=ExtResource("5_4hge2")]
|
||||||
position = Vector2(48, 256)
|
position = Vector2(48, 256)
|
||||||
|
|
||||||
|
|
@ -257,6 +260,10 @@ position = Vector2(48, 256)
|
||||||
sprite_frames = SubResource("SpriteFrames_m26wn")
|
sprite_frames = SubResource("SpriteFrames_m26wn")
|
||||||
animation = &"Idle Left"
|
animation = &"Idle Left"
|
||||||
|
|
||||||
|
[node name="SpeachRadius" parent="Entities/Guard1" index="5"]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
[node name="Guard2" parent="Entities" instance=ExtResource("5_4hge2")]
|
[node name="Guard2" parent="Entities" instance=ExtResource("5_4hge2")]
|
||||||
position = Vector2(48, 208)
|
position = Vector2(48, 208)
|
||||||
|
|
||||||
|
|
@ -264,6 +271,12 @@ position = Vector2(48, 208)
|
||||||
sprite_frames = SubResource("SpriteFrames_k3o61")
|
sprite_frames = SubResource("SpriteFrames_k3o61")
|
||||||
animation = &"Idle Left"
|
animation = &"Idle Left"
|
||||||
|
|
||||||
|
[node name="SpeachRadius" parent="Entities/Guard2" index="5"]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[connection signal="area_exited" from="Entities/ToggleRoofTrigger" to="Entities/ToggleRoofTrigger" method="_on_area_exited"]
|
||||||
|
|
||||||
[editable path="Entities/ToggleRoofTrigger"]
|
[editable path="Entities/ToggleRoofTrigger"]
|
||||||
[editable path="Entities/Guard1"]
|
[editable path="Entities/Guard1"]
|
||||||
[editable path="Entities/Guard2"]
|
[editable path="Entities/Guard2"]
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,11 @@ layout_mode = 2
|
||||||
theme_override_fonts/font = ExtResource("6_2yu03")
|
theme_override_fonts/font = ExtResource("6_2yu03")
|
||||||
text = "Pass"
|
text = "Pass"
|
||||||
|
|
||||||
|
[node name="Speak Buton" type="Button" parent="UI/Left Display/Contents/Command Menu"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("6_2yu03")
|
||||||
|
text = "Speak"
|
||||||
|
|
||||||
[node name="Message Console" type="MarginContainer" parent="UI" node_paths=PackedStringArray("scrollContainer", "messages")]
|
[node name="Message Console" type="MarginContainer" parent="UI" node_paths=PackedStringArray("scrollContainer", "messages")]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 13.0
|
offset_left = 13.0
|
||||||
|
|
@ -136,3 +141,4 @@ position = Vector2(26, 0)
|
||||||
[connection signal="BROADCAST_COMMAND" from="Command Processor" to="UI/Message Console" method="_on_command"]
|
[connection signal="BROADCAST_COMMAND" from="Command Processor" to="UI/Message Console" method="_on_command"]
|
||||||
[connection signal="timeout" from="Command Processor" to="Command Processor" method="_on_timeout"]
|
[connection signal="timeout" from="Command Processor" to="Command Processor" method="_on_timeout"]
|
||||||
[connection signal="pressed" from="UI/Left Display/Contents/Command Menu/Pass Button" to="UI" method="_on_pass_button_pressed"]
|
[connection signal="pressed" from="UI/Left Display/Contents/Command Menu/Pass Button" to="UI" method="_on_pass_button_pressed"]
|
||||||
|
[connection signal="pressed" from="UI/Left Display/Contents/Command Menu/Speak Buton" to="UI" method="_on_speak_button_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ signal PAUSE_PROCESSOR
|
||||||
|
|
||||||
# Game Signals
|
# Game Signals
|
||||||
signal PLAYER_MOVE(direction)
|
signal PLAYER_MOVE(direction)
|
||||||
|
signal PLAYER_SPEAK
|
||||||
|
|
||||||
# Message Console Signals
|
# Message Console Signals
|
||||||
signal DISPLAY_MESSAGE(message)
|
signal DISPLAY_MESSAGE(message)
|
||||||
|
|
@ -16,4 +17,4 @@ signal DISPLAY_CLEAR
|
||||||
signal LOAD_MAP(currentMap, newMapPath, spawnpoint, facing)
|
signal LOAD_MAP(currentMap, newMapPath, spawnpoint, facing)
|
||||||
signal LOAD_COMPLETE
|
signal LOAD_COMPLETE
|
||||||
|
|
||||||
signal TOGGLE_TILEMAP_LAYER(layerName)
|
signal TOGGLE_TILEMAP_LAYER(layerName, visible)
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,4 @@ func _init():
|
||||||
|
|
||||||
|
|
||||||
func execute():
|
func execute():
|
||||||
print("Player passed.")
|
|
||||||
COMMAND_PROCESSED.emit(commandLabel)
|
COMMAND_PROCESSED.emit(commandLabel)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
extends Command
|
||||||
|
|
||||||
|
class_name SpeakCommand
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
commandLabel = "Speak"
|
||||||
|
|
||||||
|
|
||||||
|
func execute():
|
||||||
|
CommandDispatcher.PLAYER_SPEAK.emit()
|
||||||
|
COMMAND_PROCESSED.emit(commandLabel)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cnpwcq7khum55
|
||||||
|
|
@ -12,6 +12,7 @@ var player
|
||||||
func _ready():
|
func _ready():
|
||||||
CommandDispatcher.PLAYER_MOVE.connect(onPlayerMove)
|
CommandDispatcher.PLAYER_MOVE.connect(onPlayerMove)
|
||||||
CommandDispatcher.TOGGLE_TILEMAP_LAYER.connect(onToggleRequest)
|
CommandDispatcher.TOGGLE_TILEMAP_LAYER.connect(onToggleRequest)
|
||||||
|
CommandDispatcher.PLAYER_SPEAK.connect(onSpeak)
|
||||||
|
|
||||||
|
|
||||||
@warning_ignore("unused_parameter")
|
@warning_ignore("unused_parameter")
|
||||||
|
|
@ -50,10 +51,20 @@ func playerCanMoveTo(newPosition) -> bool:
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
func onToggleRequest(layerName):
|
func onToggleRequest(layerName, visible):
|
||||||
for layer in range(get_layers_count()):
|
for layer in range(get_layers_count()):
|
||||||
if(get_layer_name(layer) == layerName):
|
if(get_layer_name(layer) == layerName):
|
||||||
if(is_layer_enabled(layer)):
|
set_layer_enabled(layer, visible)
|
||||||
set_layer_enabled(layer, false)
|
|
||||||
|
|
||||||
|
func onSpeak():
|
||||||
|
var interactables:Array = player.speechCollider.get_overlapping_areas()
|
||||||
|
|
||||||
|
if (interactables.size() > 0):
|
||||||
|
for interactable in interactables:
|
||||||
|
interactable.get_parent().interact()
|
||||||
else:
|
else:
|
||||||
set_layer_enabled(layer, true)
|
CommandDispatcher.DISPLAY_MESSAGE.emit("There is no one to speak to.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ class_name ToggleRoofTrigger
|
||||||
@export var layerName:String
|
@export var layerName:String
|
||||||
|
|
||||||
func execute(target):
|
func execute(target):
|
||||||
CommandDispatcher.TOGGLE_TILEMAP_LAYER.emit(layerName)
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_area_entered(area: Area2D) -> void:
|
func _on_area_entered(area: Area2D) -> void:
|
||||||
execute(area.get_parent())
|
CommandDispatcher.TOGGLE_TILEMAP_LAYER.emit(layerName, false)
|
||||||
|
print("entered")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_exited(area: Area2D) -> void:
|
||||||
|
CommandDispatcher.TOGGLE_TILEMAP_LAYER.emit(layerName, true)
|
||||||
|
print("exited")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ class_name Mob
|
||||||
@export var collisionRay_1:RayCast2D
|
@export var collisionRay_1:RayCast2D
|
||||||
@export var collisionRay_2:RayCast2D
|
@export var collisionRay_2:RayCast2D
|
||||||
|
|
||||||
|
@export var speechCollider:Area2D
|
||||||
|
|
||||||
func updateRaycasts(destination):
|
func updateRaycasts(destination):
|
||||||
var direction = destination - position
|
var direction = destination - position
|
||||||
|
|
||||||
|
|
@ -80,3 +82,7 @@ func wouldCollideAt(destination):
|
||||||
|
|
||||||
if collisionRay_1.is_colliding() || collisionRay_2.is_colliding():
|
if collisionRay_1.is_colliding() || collisionRay_2.is_colliding():
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func interact():
|
||||||
|
print("Player interacted with %s" % name)
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,7 @@ class_name UI
|
||||||
|
|
||||||
func _on_pass_button_pressed():
|
func _on_pass_button_pressed():
|
||||||
CommandDispatcher.PROCESS_COMMAND.emit(PassCommand.new())
|
CommandDispatcher.PROCESS_COMMAND.emit(PassCommand.new())
|
||||||
|
|
||||||
|
|
||||||
|
func _on_speak_button_pressed() -> void:
|
||||||
|
CommandDispatcher.PROCESS_COMMAND.emit(SpeakCommand.new())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue