Help here !!! dop2000 or RojoHound or anybody,,, Need to sort numbers from Biggest to small?

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.

    at the final lap each player will get extra points , But what I really need its to sort those numbers from Biggest to small in a new Layer ,,,, Thank you very much in advance and I hope anybody from this forum could help me on this one !!!

    Put them into an array and use Array Sort action.

    Or if these values are stored in instance variables (for example, Position instance variable on Car sprite) - you can do:

    For Each Car order by Car.Position descending
    .. Text append Car.Name & " " & Car.Position 
    

    Put them into an array and use Array Sort action.

    Or if these values are stored in instance variables (for example, Position instance variable on Car sprite) - you can do:

    > For Each Car order by Car.Position descending
    .. Text append Car.Name & " " & Car.Position 
    

    Oh my friend, the cars are not in position , Im using Global Variables to the last point ranks , not instance variables within an object >>> I would apreciate an example capx if you are willing to do it >> cause Im trying in many ways but nothing happens yet>> I already did the car ranks at the end of the lap but know Im trying to sort the final points I give to each car. Thank you friend !!! Let me know if anything cause Im not an advanced programer.

    I suggest using instance variables. See this example.

    Or copy all results to an array and sort it. Array -> Sort action

    I suggest using instance variables. See this example.

    Or copy all results to an array and sort it. Array -> Sort action

    No no maybe you are mistaken my question >> I already got made the ending lap mechanics at 100% in my game since long time >> But what I need now its to put in order the final points number that I give to each car , and Im not using arrays in my project , could there be another way around , and I dont know if the c3 arrays will work exactly with the c2 arrays,,, thank you friend !! I'm looking for a mini demo capx that could give me a little help until figured things on that exactly mechanic.

    You don't want to use instance variables and you don't want to use arrays. I don't have other suggestions for you..

    Things get far less simple to do sorting without arrays or instance variables.

    Global variables are handy but get tedious to manipulate. You’ll end up with more events too.

    I’m bored though and know a silly way to sort with waits. For example with three global variables. You’d basically add an additional event per global. To use just set sort to 1 somewhere in your events and it’ll sort in basically a second. I won’t be making an example.

    Var sort=0
    
    Compare: sort=1
    — wait 1/global1 seconds
    — text: append text global1&newline
    
    Compare: sort=1
    — wait 1/global2 seconds
    — text: append text global2&newline
    
    Compare: sort=1
    — wait 1/global3 seconds
    — text: append text global3&newline
    
    Compare: sort=1
    — text: set text to “”
    — set sort to 0

    Probably works best when sorting values in the range of 1-60. Higher values won’t sort right. Values of 0 will never sort.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    dop2000 and Rojohound From the bottom of my heart I appreciate all the help from both of you guys and I hope you guy keep helping us in a future ,, but one thing here its that the majority of us in here we are not professionals using and creating codes , that's why sometimes we need mini demo capx or at least some references Pics created with Construct >> Right now I don't understand the mini example script RojoHound posted about sorting without arrays >>> If there were that same example but with a picture in reference with Construct I'll bet I could understand it in almost a 100% ,, thank you guys for everything and I'll keep trying doing it the hard hard way to see what's the outcome >>> since 2 day ago I'm trying this method by repeating 8 conditions for each player without using ARRAYS >>> pics down below

    Sorry. That’s more help than I’m able to provide.

    Sorry. That’s more help than I’m able to provide.

    its ok ,,, sooner or later I always figured out something ,,, Thank you.

    Or just spend 20 minutes reading about C3 arrays. Copy all values from global variables into the array. Sort it. Display on the screen, or copy back to global variables.

    Copy all values from global variables into the array. Sort it. Display on the screen, or copy back to global variables.

    Show me how to do it my friend cause like I said before I know some things from Construct but not all them , Thats why Im asking >> I'll pay for the capx trust me I'll do it cause my time its gold and I have so many thing than Im working on my project. at least a little example on a picture with the same Globals Im using.

    In the future use instance variables.

    In the future use instance variables.

    Thank you !!! and by the way before you posted this I already was trying to get in the mood with the arrays and this I did , but know I'll try your method to see which one to choose !! Thank you and like I said before sooner or later I'll get to it >> Ill try your method right now to see the outcome>>> Thank you dop2000 you are the one!!!

    You coded your game badly. We all do it when we first start.

    People here showed you how to do it a better way, they were olite and gave you multiple options, but you were unwilling to learn.

    It's not people helping you giving excuses lol.

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