End of lesson 26
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
11
scripts/game/maps/entities/map_entity.gd
Normal file
11
scripts/game/maps/entities/map_entity.gd
Normal 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())
|
||||
1
scripts/game/maps/entities/map_entity.gd.uid
Normal file
1
scripts/game/maps/entities/map_entity.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dypu0r4iadf8u
|
||||
Reference in New Issue
Block a user