Instanced loops

This forum is currently in read-only mode.
  • I'm creating a loop based platform engine, and I want more players to be on the screen at the same time.

    I want to use the same sprite for the different players, and only change a variable to make each player control his sprite.

    This looks like the best solution to have a low amount of events.

    However, the loop isn't obviously instanced for each player, so when the loop stops for a sprite, it stops for every sprite.

    How can I solve this?

  • for each player

    You've pretty much answered your own question there. Make two loops:

    + For each player
        + While Player is overlapping ground
            -> Push Player out
    [/code:2jdtry09]
    
    Just be careful with nesting loops, because they can turn into CPU eaters pretty quick.
  • dependin on how many players you will use it might be better to just use a cloned sprite and repeat the events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In fact you can put a loop below any condition at all that picks from 'player', and the actions will only run on the instance(s) that met the parent event. This is how subevents work - they inherit the picking from the parent.

    Edit: manontherun: that actually wouldn't be a good idea, it would be much more work! It's easily possible with deadeye's method.

  • depending on players quote, because nested loop is suggested. but i dont disagree with you.

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