How to place objects in room be made of sprite.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HorseGorilla

I created a room with sprites. and I want to place an object in that room.

Is there any other way to arrange the room locations?

Sorry for my weird english.

thank you.

Can you tell more about the background of the game. What you want to do is not clear

Help me please | 2021-07-27 06:38

:bust_in_silhouette: Reply From: Help me please

Assuming that the objects are like table, chair, furniture etc. And your game has nothing to do with collisions of the room and player. And the objects and your room are just static images.
Then you can add more sprites for your objects to overlap the room.

Or if you want to add these objects during the game then

func _input(event):
	if event.is_action_pressed("click"):
		var sprite =
		sprite.texture =  preload("res://icon.png")
		sprite.position = event.get_position()

You just have to add an input named click with action left button of mouse

I am not clear about your question. Sorry if it’s not the answer.
If you tell more about the background of the game then I can tell you better answer. What you want to do is not clear

Thank to your answer and sorry for my ambiguous question.

I was make my room generation like the Binding of Isaac.(if player entered the door, add child next_room and remove child current_room)

I want to know as arrange rock, or another objects regularly to their rooms. (specific rule?)

use array get the vaule of room position? and In array, whether there is or not objects (empty => 0, object1 => 1 etc.)

I think there is only that. Is there any other good way? If you create an array, the x and y indexes exceed 20, so it doesn’t seem like a good way. (By default, there are more than 10 rooms.)
I explained by painting.

HorseGorilla | 2021-07-27 13:40

If you want to make the room during the game then probably you have to use an array. When I was making my game of building then I myself used an array and checked if that coordinate is in that array or not and then acted accordingly.

Or you can make the room in the editor and then add that as child.

Help me please | 2021-07-28 03:31

Thanks for your knowledge. After all, there will be only an array.

HorseGorilla | 2021-07-28 13:14