Containers and Spawning

This forum is currently in read-only mode.
  • I have a "Ship" sprite object and an "Exhaust" particles object. I created three instances of the Exhaust sprite by CTRL+dragging. I then added all three exhaust instances to the Ship sprite container. However, the sprites are not behaving as I expect in two ways:

    1) When I click on the Ship sprite, only the first Exhaust object is highlighted with the green box. Is this a bug?

    2) The documentation (http://sourceforge.net/apps/mediawiki/construct/index.php?title=Containers) says that all objects in a container are spawned when the primary object is. However, when I run in debug mode, no exhaust objects are spawned when I spawn a ship.

    Thoughts?

  • Posting a .Cap always helps people to see what is going on. and Im not sure how the edit time handles containers, but i dont think it makes the for you. your better off having them created at runtime anyways.

  • and an "Exhaust" particles object.

    [quote:1cp3tsn2]of the Exhaust sprite

    Is Exhaust a sprite or a particles object?

    Anyhoo, when you select an object, the other objects in the same container get selected in yellow. When you create one, the others get created too, but you need to set their positions. Maybe they were created off-screen?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Posting a .Cap always helps people to see what is going on.

    Here it is: http://sites.google.com/a/mike-wyatt.com/mike-wyatt-s-blog/spacebattle.cap?attredirects=0

    The "Ship" sprite object is called "Frigate" in the cap, and "Exhaust" is actually "FrigateExhaust".

    Im not sure how the edit time handles containers, but i dont think it makes the for you. your better off having them created at runtime anyways.

    I really hope I can get it working. I want to let the player choose different ships when the game starts, but not duplicate all the events for each ship type. Each ship could have different child objects, so I'd need to write custom event code that spawns them if the container won't take care of that for me.

    Is Exhaust a sprite or a particles object?

    Oops, sorry, that was a typo. The Exhaust object is a "Particles" object.

    Anyhoo, when you select an object, the other objects in the same container get selected in yellow. When you create one, the others get created too, but you need to set their positions. Maybe they were created off-screen?

    When running in debug mode, no additional exhaust objects are created at all.

    Here's what the sprite/container looks like in the editor:

    <img src="http://sites.google.com/a/mike-wyatt.com/mike-wyatt-s-blog/frigatecontainer.jpg">

    I've noticed that when adding exhaust objects to the ship container that I'm always selecting the same object from the list. I'd need a way to associate a specific instance, which I don't think I'm doing.

  • Here it is: http://sites.google.com/a/mike-wyatt.com/mike-wyatt-s-blog/spacebattle.cap

    Hey MikeWyatt, my name isn't Mike Wyatt, it makes it kind of hard for me to log into Mike Wyatt's blog at MikeWyattDotCom as Mike Wyatt.

    <img src="http://i50.tinypic.com/2isd25f.png">

    You might want to sort out your hosting

  • Doh! That's what I get for trying something new. I'll fix it when I get home.

  • The link should work now.

  • Ah, I can see your screenshot now as well. I know what the trouble is.

    When something is contained with something else, you can only contain one instance of each object. Think "Ice cream and Cake," not "Ice cream and Cake and Cake and Cake." There's just too much cake.

    You have one ship, and three exhausts. You can only contain one of those exhausts. Each of the other two exhaust objects want to belong in a different container with their own respective ships.

    Since you want to attach three of the same object to your ship, you should use the Pairer object:

    http://dl.dropbox.com/u/529356/awesomespaceship.cap

    That should do the trick.

  • Your example is exactly what I want. The ObjectPairer makes more sense now. Thanks!

  • hey! I wanted to know how to use the Object Pairer too, thanks

    now some thread keywords: Object Pairer example examples file pairing container

  • Hey Madster, guess what...

    That was the first time I ever used it . It doesn't really work any differently than any other object, and it seems pretty intuitive.

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