Dynamic list

0 favourites
  • 6 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Background


    I'm trying to make a matchmaking interface

    The player and the enemy will take turns picking soldiers(sprites) from a list of available soldier

    I want the list to change its order in a way that the better pick goes first (left to right top to bottom)



    I've managed to set the parameters of each sprite by adding instance variables.

    I do not know how to create this dyanmic list that can modify the order of the sprites according to the conditions ill give it..


  • You need to use System For Each (ordered) event.

    For example:

    System For Each Soldier (order by Soldier.attackDamage) descending -> Soldier set position to (X=50+loopindex*100, Y=500)

    This will arrange Soldiers on the screen by their attack damage, strongest first.

  • Hi, thanks a-lot, im still new to this so im not sure to which system you're referring too ill be extremely happy if you can elaborate thanks!!!

  • "System" object.

    In the event sheet click "Add event" -> click System -> select For each (ordered)

  • Oh you meant that , cool ive managed thanks alot, only problem now is that my sprites leave the screen, instead of creating a list (left . to right and top to bottom) its just left to right, any solution for this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didn't know how you wanted to arrange your soldiers.

    If you want a grid with 10 soldiers in each row, you can do this:

    variable posX

    variable posY

    System For Each Soldier (order by Soldier.attackDamage) descending

    ....Set posX to (loopindex%10)*70

    ....Set posY to int(loopindex/10)*70

    ....Soldier set position to (X= 50+posX, Y=50 +posY)

    Or you can put invisible "placeholder" sprites to where you want to place your soldiers. And then set position to (X=placeholderSprite(loopindex).x, Y=placeholderSprite(loopindex).y)

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