How do I create objects full of objects?

0 favourites
  • 13 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • This seems like such a simple thing to not be able to figure out on my own. For example, I have a room full of furniture and I need to be able to plop another instance that same room furniture and all.

  • Just for clarification... group selecting and copy/paste within the editor is not sufficient. I need to be able to spawn the populated room by using events.

  • The answer seems to be containers. Off to read some documentation.

    construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

  • If one object in a container is destroyed, every other associated object in its container is also destroyed. If a condition picks one object in a container, every other associated object in its container is also picked.

    This won't do. What if I have doors, interactive or breakable objects inside?

  • You can make the door invisible, disable its collisions, or remove from the screen.

    Note, that containers are only for logical linking multiple objects. You should not expect that all sprites in the room will remember their relative positions to each other or something like that.

    Also, be aware that containers can hold only one instance of each object. If you need 3 identical doors in one room, you can't do this with the container.

  • Yeah I'm going to need a different solution. Let me explain exactly what I need to do...

    I need a room made up of a floor, wall and ceiling sprites. Inside I need to have objects that come with the room such as furniture and a door on either side. These rooms need to be spawnable and droppable by the player. Imagine a template on the side of the screen where you can drag prefab rooms out and place them.

  • Each object should have instance variables for x,y positions, z order ( or you can just create them in certain order ) Then when you drop the main room ( wall, floor object or a thumbnail of the room, whatever ) into a layout it spawns everything else and places it into its x,y positions

  • That sounds pretty painful. There needs to be a way to automate that. Like nodes in Godot.

  • Each object should have instance variables for x,y positions, z order ( or you can just create them in certain order ) Then when you drop the main room ( wall, floor object or a thumbnail of the room, whatever ) into a layout it spawns everything else and sets it to their x,y positions

    You know I've been thinking about what you said here... and I bet with the use of families I could automate this. Still should be built in though ;)

  • Welcome to the wonderful world of functions.

  • Assuming you can spawn the room by events the first time, there shouldn't be anything keeping you from doing it on demand. Like newt said, if you use a function you can add parameters for any variables you want, like location or contents.

  • Spooky Spirits I have just posted a demo which may help you with this task:

    howtoconstructdemos.com/generate-random-levels-from-pre-built-scenes

    You can use the same method to copy rooms in your game.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Spooky Spirits I have just posted a demo which may help you with this task:

    https://howtoconstructdemos.com/generate-random-levels-from-pre-built-scenes/

    You can use the same method to copy rooms in your game.

    I downloaded this and will check it out soon. Thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)