[R72] * Bug or Feature? * Sine, Spawn & OnOver

  • I'm still working on my simple shooter, which utilizes sine behavior.

    Ont thing that strikes me as a bug is the following:

    <img src="http://quak.laurig.de/step07.JPG" border="0">

    Here you see, that I itterate over a certain amount to spawn targets. What is interessting is, that the "WAIT" step will not be executed, or hast no effect on the loop.

    This causes that all targets, which will be moved by two combined sines are very, very close together - which then leads to the next issue:

    <img src="http://quak.laurig.de/step08.JPG" border="0">

    When "shot" on and more then one target is at the same position ALL targets that share the x,y position are hit and removed - regardless of ther z coordinate....is this a bug or a feature?!?

    Here is the CAPX

    And here the online DEMO

  • 'Wait' at the end of an event does nothing! Have you seen How to use the 'Wait' action?

    'Wait' causes a delay then it carries on running from when it left off. If 'Wait' comes at the end of an event it means 'Wait this amount of time then do nothing', so it has no effect.

    I guess you're confused because it's in a loop, but that doesn't make it wait between each loop iteration - instead it schedules waits in parallel, e.g:

    + Repeat 10 times

    -> Do something

    -> Wait 1 second

    means "Do something then wait 1 second and do nothing, 10 times in a row". Events keep on running during a 'Wait' so the rest of the loop carries on running.

    I'm not sure what you mean in your second example though, can you maybe reproduce it in a new empty project?

  • So how can I delay a loop?

  • Do you want to delay in between each iteration, or delay the start of the loop?

    Just put a 'wait' before the loop itself (in a parent event) to delay the whole loop. To delay each iteration you can't really use the loop event, because the loop carries on running while the waits wait. In that case I'd just not use loops at all - have some timed events with variables or something.

  • ok, so the not delayable loop is a feature <img src="smileys/smiley2.gif" border="0" align="middle" />

    For the "second" part of my question...

    When spawned, a total of 10 instances will be created. All of them will be moved using two sine - both with random tweaks, so sooner or later the 10 targets will seperate BUT the are times, where more than one instance cover each other on the gamelayer. Now when they are shot ALL of them are "picked" and therefore destroyed - I'd rather have only one instance picked and killed....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • By design 'is overlapping' picks *all* the instances it's overlapping. I guess you need to follow it with a 'pick topmost' condition, but Sprite doesn't have one - I'll see if I can add it for the next build.

  • Yes "Pick the topmost" would do very nicely - thank you!

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