End of lesson 26

This commit is contained in:
Penelope 2025-04-17 18:02:54 -03:00
parent 68373a3820
commit c586c869b3
9 changed files with 48 additions and 11 deletions

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://b1x2qqok7xafr"]
[ext_resource type="Script" uid="uid://dypu0r4iadf8u" path="res://scripts/game/maps/entities/map_entity.gd" id="1_4euqm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_agn4j"]
size = Vector2(4, 4)
[node name="MapEntity" type="Area2D"]
script = ExtResource("1_4euqm")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, 8)
shape = SubResource("RectangleShape2D_agn4j")
[connection signal="area_entered" from="." to="." method="_on_area_entered"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://d3e5mg0gk8u7r"]
[gd_scene load_steps=21 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"]
@ -122,6 +122,9 @@ animations = [{
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mu6cs"]
size = Vector2(4, 4)
[node name="Mob" type="Node2D" node_paths=PackedStringArray("animator", "collisionRay_1", "collisionRay_2")]
script = ExtResource("1_mu6cs")
animator = NodePath("AnimatedSprite2D")
@ -144,3 +147,9 @@ collide_with_areas = true
position = Vector2(8, 8)
target_position = Vector2(0, 16)
collide_with_areas = true
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(8, 8)
shape = SubResource("RectangleShape2D_mu6cs")

File diff suppressed because one or more lines are too long

View File

@ -92,12 +92,8 @@ handle_input_locally = false
size = Vector2i(493, 235)
render_target_update_mode = 4
[node name="MapContainer" type="Node" parent="UI/Map View/SubViewport" node_paths=PackedStringArray("entities")]
[node name="MapContainer" type="Node" parent="UI/Map View/SubViewport"]
script = ExtResource("3_vnpv3")
entities = NodePath("Entities")
[node name="Entities" type="Node2D" parent="UI/Map View/SubViewport/MapContainer"]
z_index = 1
[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"]

View File

@ -5,6 +5,7 @@
[node name="MessageLine" type="RichTextLabel"]
theme = ExtResource("1_re2k6")
text = "Enter Command:
"
fit_content = true
scroll_active = false

View File

@ -1,7 +1,5 @@
extends Node
@export var entities:Node
var map:Map
func _ready():
@ -20,7 +18,7 @@ func loadMap(newMapPath, spawnpoint, facing):
add_child(map)
entities.add_child(map.spawnPlayerAtPosition(spawnpoint, facing))
map.get_node("Entities").add_child(map.spawnPlayerAtPosition(spawnpoint, facing))
GameManager.currentMap = newMapPath

View File

@ -0,0 +1,11 @@
extends Area2D
class_name MapEntity
func execute(target):
print(target.name)
func _on_area_entered(area: Area2D) -> void:
execute(area.get_parent())

View File

@ -0,0 +1 @@
uid://dypu0r4iadf8u

View File

@ -40,5 +40,5 @@ Button/styles/hover = SubResource("StyleBoxTexture_r3xux")
Button/styles/normal = SubResource("StyleBoxTexture_oxkhk")
Button/styles/pressed = SubResource("StyleBoxTexture_pvobe")
Label/fonts/font = ExtResource("1_lkf7m")
RichTextLabel/font_sizes/normal_font_size = 10
RichTextLabel/font_sizes/normal_font_size = 12
RichTextLabel/fonts/normal_font = ExtResource("1_lkf7m")