0 Favourites

How do I not get my sprites overlapping when spawning

  • i need help for this simple task cause i simply cant figure it out .

    So the problem is that if i start spamming alot they will spawn inside each other and take abou 3 seconds to actually slowly not get stuck and i dont want that i would like them to just bounce out or something like that

    i know it seems a bit confusing but here is my project hopefully you guys can help me <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    https://dl.dropboxusercontent.com/u/763 ... umber.capx

  • How to cage a trigger to once/tick.

    https://www.dropbox.com/s/ihqsrk5qqpilk ... .capx?dl=0

    Else there is virtual no limit to how many times a trigger can fire / tick ... & things gooing Async as hell.

  • How to cage a trigger to once/tick.

    https://www.dropbox.com/s/ihqsrk5qqpilk ... .capx?dl=0

    Else there is virtual no limit to how many times a trigger can fire / tick ... & things gooing Async as hell.

    could you explain how you did it i only get a few things but most im a noob with so i dont understand

  • The main problem you had is this:

    A trigger happens !. It is not 'running top down' on its dedicated place in the events sheet. It runs when it is triggered by 'the happening' that it is designed to catch.

    So, 'on key pressed' runs when the key is pressed. Instantly. When you press the key very fast, that event starts even running before the previous run of that event is completed.

    Result: it runs several times in 1 tick, starting to pile up in that one event. Spawning under the same conditions. All on 1 position.

    So, i figured, the best option is to sync the 'on key pressed' with the amount of ticks the system can swallow / sec. At a ratio 1 to 1.

    To accomplish this, i use a global variable. I set it to 1 when the key is pressed. At the same time i only allow the 'on key pressed' run its actions when that global = 0. So, after the first press, the global = 1, and can not be executed again till that global = 0 again.

    If i set that global = 0 in a new event. (in event 7), the 'on key pressed' can therefor only run its actions (and sub events) ONCE every tick. Now everything (creation, physics, position calculations) runs in SYNC.

    This is ofcours not perfect, players on faster machine can spawn faster.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • The main problem you had is this:

    A trigger happens !. It is not 'running top down' on its dedicated place in the events sheet. It runs when it is triggered by 'the happening' that it is designed to catch.

    So, 'on key pressed' runs when the key is pressed. Instantly. When you press the key very fast, that event starts even running before the previous run of that event is completed.

    Result: it runs several times in 1 tick, starting to pile up in that one event. Spawning under the same conditions. All on 1 position.

    So, i figured, the best option is to sync the 'on key pressed' with the amount of ticks the system can swallow / sec. At a ratio 1 to 1.

    To accomplish this, i use a global variable. I set it to 1 when the key is pressed. At the same time i only allow the 'on key pressed' run its actions when that global = 0. So, after the first press, the global = 1, and can not be executed again till that global = 0 again.

    If i set that global = 0 in a new event. (in event 7), the 'on key pressed' can therefor only run its actions (and sub events) ONCE every tick. Now everything (creation, physics, position calculations) runs in SYNC.

    This is ofcours not perfect, players on faster machine can spawn faster.

    oh thats smart thanks for all the help now i get it

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