Overlapping and changing order

0 favourites
  • 11 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • How do I:

    In the context of spawning and then having the sprite with the heighest Y value go above a sprite with a lower Y value on the Z axis (eg it looks on top of it,) ? Thanks.

  • Worth noting that all these sprites are off the same instance eg: "Enemy 1" and are spawned in masses and walk in one fixed direction.

    There is no way of setting them to say "Enemy X"

    Thanks.

  • Just one event needed. Two conditions: System: On start of layout (or whenever) and System: For each (Sprite) order by Sprite.Y -> (Sprite) Move to top of layer.

    Just be sure you set your origin points correctly.

    Example capx.

  • just like this sample?

    http://goo.gl/1a3Jt

    Use a family and sort with 'FOR EACH" the Y to be on top of each other.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • GeometriX &@TELLES0808

    Thank you guys. GeometriX' worked the best-- another question is:

    My sprites tend to stack up; important things to know:

    They all walk at the same pace and towards the same direction,so I can have about 3 pretty much on top of eachother but give or take a few pixels...

    I want to know, how:

    At spawn time, to create a scenario where "If there is a zombie at that Y coordinate within 5 pixels of wherever it was thinking of spawning, do not spawn!"

    :P Thanks

  • As always, you've got a lot of options. I'd suggest that, instead of spawning your sprites directly, use a "scouting" object to test the waters. Spawn those randomly, then, if they're not overlapping anything, it's safe to spawn an enemy or whatever. If it is overlapping then go find somewhere else to spawn.

    Here's an example capx. It'll generate new blocks until it can't any more, at which point it simply crashes when it runs out of space.

    If you want to allow some overlapping, just set the scouting object to be smaller than the objects you're spawning.

  • theres lot of options, but i guess you could even do it with the line of sight behavior on the spawnbox, adjust the range, and then inverse is in sight, could be that youl need some "for each" zombie and spawnbox

  • GeometriX thanks buddy!

    Saved me a good few hours there haha! You don't happen to know how to create a range saying

    "Create object ZombieSpawner on layer 0 at (0.1, random(Y AMOUNT *SOMETHING* 450))

    Basically I don't want them spawning below an amount of 'Y amount'

    Thanks

  • Random(100,450), for example, will spawn it between 100 and 450 - it's in the manual under system expressions.

  • GeometriX ahhhhh thank you! I was looking under sprite expressions and I couldn't find it!

    Thanks again; I couldn't remember if it was a comma or a semi-colon :)

  • My pleasure, and good luck with your game :)

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