MikeWyatt's Forum Posts

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

  • 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.

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies, guys. That helps a lot.

    [quote:1s7x086n]Yes, but mainly because they are logically separate objects. The player spaceship is controlled by the player rather than AI and that's enough to justify making them separate.

    That makes sense. I really like the idea of not duplicating stuff like the image points, collision settings, and behaviours, though. Right now I'm playing with storing a global "PlayerUID" variable that is then used as a conditional for apply player input to the one instance. Or, even better, I could have an "Is Player" private variable in the specific instance and avoid having a global variable.

    I'm also playing with attaching ship-specific stuff like exhaust (particles) to the ship, since it looks like containers automatically handle the spawning of "child" objects in the container.

  • Construct's treatment of objects and instances has been pretty confusing for me, so far. Maybe it's because I've been programming for a long time and see a very sharp distinction between classes (Construct objects) and objects (Construct instances). Construct seems to treat the two concepts as the same thing, at times. Specifically when defining event actions: Does the "Cruiser" in "Create object Asteroid at Cruiser.X, Cruiser.Y)" refer to all cruisers, or the first/last one that was spawned? I'm sure I'll figure it out eventually, but it's just giving me some trouble right now. It seems like both cases are true, depending on the situation. A System:Destroy command for a given object destroys all instances, unless it is immediately after a spawn action that created a specific instance.

    In any case, would it help if I consider that all instances of the same type have the exact same properties and event handling? Only the private variable state is different?

    In other words, if I want the player to fly around in a spaceship, and the enemies to fly around in the same spaceship, would I want to create two separate Construct objects? Both would share the same source image and probably have similar collision and image point settings, but one would have player input-related event actions and the other would have AI event actions?

    That seems more in line with how Construct works, and I wouldn't need to worry so much about which instance is being referred to in an event. I could simply assume that the Ship in player actions is the player, and the Ship in enemy actions is all enemy ships.