Godot Version
4.4.1
Question
I have a room generation script that spawns a room. The room has a Enemies node that holds 3 Enemy scenes. These are placed by hand, and not through code. The room gen script instantiates the room, then places it at some global coordinate. When I run the game, the enemies are all stacked onto the same spots in the global area.
Here is the room scene code:
func place_room_at_xy(coords:Vector4,center:Vector2):
var tile_offset = Globals.room_size * Globals.tile_size
var newRoom:Node2D
for i in range(0,len(roomsack)):
var tempRoom:Node2D = roomsack[i].instantiate()
if tempRoom.get_exit_type() == coords.z:
if tempRoom.get_room_rotation() == coords.w:
newRoom = tempRoom
var adjusted_coords:Vector2 = Vector2(coords.x,coords.y)
adjusted_coords -= center
adjusted_coords *= tile_offset
adjusted_coords.y *= -1
add_child(newRoom)
newRoom.global_position = adjusted_coords

