Beta7's Forum Posts

    Oh yes of course ,, I only post videos for a day but not too long,,, cause I'm concentrated on my game project and not on dramas , I think this week I'll post it again for only a moment so you can see exactly the code in progress , do you have an email ,, anyways I think I know your link site

    I didn't see the video because you are deleting your comments.

    Not even close to what I did ,,, not even a little and by the way just try to do it as I showed you on the video I posted earlier and then I give cudos to you ,,, cause allllll the capx examples people showed to me are not working the way I did it by myself >> Just try it and you'll see >> and by the way let me tell you something that I do appreciated all the help you do on these forums >> But why now that I dont need what I already learned by myself you are posting capx and try to give some instructions !!?? why at the beginning you told me >> Ohh I dont have time to created capx examples or something like that you said , but know that I already figure out the code by myself you are trying to help !!??? just asking >> Cheers

    I would like to note that I purely do this for fun. I'm not a professional and have no obligation spend time to help on this forum.

    So to summarize, you have 8 global variables and you'd like to display them sorted high to low, and when you display it you want it to show the variable name with the score.

    To sort you need to get the list of values into some kind of array. That could be comma separated text, an array object or just just use multiple instances of a sprite. In the end they are all arrays just represented in different ways. I guess the main tricky part is sorting the values and knowing what variables the values came from. Anyways here are three different approaches, some of which were already covered, in one way or another, by the other helpful users on this site.

    Method 1. Text based array

    The first is to use a text variable to represent the array. list="01234567". This is the most compact way I could think of. 0 for the first global, 1 for the second and so on. Next to sort we'd have to implement our own sorting algorithm. Simplest and most compact would be bubble sort. Basically it compares two global variables from two adjacent indexes from the list and swaps the indices if needed.

    With this approach the expression chooseindex(index, p1,p2,p3...) is our friend to reduce the amount of events needed to access different globals with less events. Since it's text based the swap operation looks a bit ugly. Well in general all the expressions look busy with this approach.

    The main con with this is having to modify it if you change the number of globals you're sorting.

    https://www.dropbox.com/scl/fi/dn5oe5gwq0f9ltblvkazd/sortGlobals.c3p?rlkey=v86rolm7oceh7nhx9myy8ju51&st=pva8a0vh

    --- Three events long with an additional variable.

    Method 2: using the array object

    The second idea is to just populate an array with the global variables and sort that.

    We can recall the variable names by setting the array size to (8,2,1) and setting array.at(i,0) to the value, and (i,1) to the name or index. The sort only looks at values at y=0 and the other y's get swapped along. Anyway, it's easy enough and straightforward to use if you're not trying to avoid the array object at all costs. Most people with previous programming experience like this way.

    One con is the array sort action only sorts low to high. It's not the end of the world though. One fix is to just loop over the array in reverse like in the example, or setting the array with negative values before sorting, and negating them again when displaying.

    https://www.dropbox.com/scl/fi/4dz5bwz9ct7ex4anabvo0/sortArray.c3p?rlkey=z1l9p4xb18mqhfg4k5gkp88t5&st=z6ch8c8d

    --- Four events long with the array object

    Method 3: Using instances as an array

    With this you create a sprite type, and create enough instances for all the values. Then in events you populate the instance variables from the globals and use for each ordered to display it.

    This is where Construct really shines. It is simpler and looks much cleaner than the other two ideas. You just have to have the instances created beforehand to avoid picking pitfalls.

    https://www.dropbox.com/scl/fi/0t4vk3me4xkum6p41lz7l/sortInstanceVariables.c3p?rlkey=95yhgv684hiqtyucvmg7o41cx&st=sh0wfw11

    ---Two events long with an object type and enough instances

    Beta7 So you are saying you found a much better solution. Show it to us please.

    Dint you saw the video I post !!! everybody saw the video but you !? I think tomorrow I'll post it again ,,, so you dont believe me !?? Jajajaja for real !!! ok I'll show you the video on this week ,,, cheeeers

    Sorting without array >> dropbox.com/scl/fi/gjv75q6wo5j4dctdrc7jj/angka_no-array.capx

    *angka means number

    I had like more than four examples as this but none of them works when you are using Global Variables or Instance Variables

    Maybe some other time.

    You already did ,,, I know that ,,, cheers

    It was a friendly request by the guy that gave the most of his time trying to help. No need to get grumpy.

    I think today is a nice day for a stroll.

    Just watch the video and enjoy !!!

    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.

    If I did it by myself then tell what it is !!??? Who show me a better way !!???? cause I did it the right in a perfect way and it was totally different from what they told me , and I give my thanks to them < But Im saying that if you a want a work to be done fine then do it yourself and that's what I'm learning here,,,, I created my own code cause none of the example they gave work a 100% not even a 50% ,, its that a problem !!?? I did the code by myself so I don't see any problem with that ,,

  • No need. Oosyrag covered it.

    Can you give the Link !??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can someone from the moderators help this guy with his question. thaaaank uuuuu

    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!!!

    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.

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

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

    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

    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.

    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.