How do I create objects on "every instance" of an object

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I do some pretty advanced stuff in Construct, but now I have stumbled upon what seems to be an easy problem to solve. How do I create object1-instances on every instance of object2? I did this:

    Every 0.3 Seconds
    • object2 is on screen
    create object1 on layer "main" at (object2.X, object2.Y).

    this will only create object1 instances on the last instance of object2, not "every instance" of object2. I have browsing around the functions in construct. perhaps I am tired or just looking at it from the wrong perspective. I can't make it work. Any ideas out there?

    Background

    I'm trying to make a object-instances generate their own particles when on-screen (I'm not using the particle system, because I would rather generate instances of an object, while using sine-waves to create the behaviour of the "particles"/object-instances)

    It's a corrupted liquid mass with droplets rising and fading away from the mass, like a lava lamp but with thinner liquid.

    Shame the forum doesn't have support for gifs. I made this with a complementary box that I generate the object instances from... however, it's manual labour and will cause a lot of issues, especially since I want enemies to constructed out of this liquid. Much better with a automated process.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need only an additionally "for each object2", but this will spawn object2 every 0.3 seconds again on all objects1 on screen. So you have to look if there is already an object2.

  • This works for me

  • Thanks guys! I knew this was such a simple task to do. A for-each loop was basically what I was looking for. But I was just looking at the functions of the objects, not the system object. I should probably go to bed. I think my brain is tired xD

  • An easier way to do it would be to use 'Sprite2: spawn Sprite'. That action automatically works per instance. Since 'Create object' is a system action it will only create one instance.

  • How do I do this with an object the player can interact with ? for example, I've made a box the player can push and pull, along with a hitbox on top to prevent the player from sliding the box while standing on it. but I need that hitbox to be on every box in multiple layouts.

    here is my code for the box as well as a small segment of where I've sent the hitbox.

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