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:
2025-04-18 21:53:50 -03:00
parent ffbbfd455e
commit b0c7c3d3ff
13 changed files with 219 additions and 23 deletions

View File

@@ -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="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"]
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")
animator = NodePath("AnimatedSprite2D")
collisionRay_1 = NodePath("CollisionRayCast_1")
collisionRay_2 = NodePath("CollisionRayCast_2")
speechCollider = NodePath("SpeachRadius")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, 8)
@@ -150,17 +154,25 @@ position = Vector2(8, 8)
target_position = Vector2(0, 16)
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)
shape = SubResource("RectangleShape2D_mu6cs")
[node name="RigidBody2D" type="RigidBody2D" parent="."]
[node name="Collider" type="RigidBody2D" parent="."]
collision_layer = 6
collision_mask = 6
freeze = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collider"]
position = Vector2(8, 8)
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")

View File

@@ -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="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")]
script = ExtResource("2_us7jc")
camera = NodePath("Camera2D")
[node name="AnimatedSprite2D" parent="." index="0"]
sprite_frames = SubResource("SpriteFrames_wyylp")
[node name="Camera2D" type="Camera2D" parent="." index="3"]
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

View File

@@ -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"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_58sfy"]
size = Vector2(48, 16)
[node name="ToggleRoofTrigger" type="Area2D"]
script = ExtResource("1_58sfy")
metadata/_custom_type_script = "uid://c50fmagffbdas"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, 8)
shape = SubResource("RectangleShape2D_58sfy")
[node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
[connection signal="area_entered" from="." to="." method="_on_area_entered"]