How do I sort items and keep their names.

Get help using Construct 2

Post » Sat Oct 29, 2016 7:49 pm

Im currently working on a little game, where you can develop hardware.

The thing is i want to be able to see a list of all the CPU's developed with their names and performance number, and sorted from best to worst.

Im using arrays for storage, and im saving the performance and sorting it, and i have some text displaying it from best to worst, but how do i make it sort the CPU names . and stick them to the correct CPU?
B
5
Posts: 8
Reputation: 241

Post » Sat Oct 29, 2016 8:20 pm

To take advantage of the built in sort expression, you'll need the category to be sorted by as your first x row. The simplest way to do this is to have a second array for sorted results. Whenever you need to display sorted information, copy the original array to the sorter array with the sorting category as your first row, then sort.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Sat Oct 29, 2016 10:01 pm

Or.

Use the X-axes for its index only, meaning : dont store values on the X-axis.
Store values on the y-axis.

Now if you need to sort, you just copy the y value (that you want to sort on) to the x axis, sort on x, done.
Easy as this.
https://www.dropbox.com/s/trabdwutpnuge ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Oct 30, 2016 7:57 pm

Thank you Instances for the help! :D all thats left is to add some simple competitors, that should be easy, right?
B
5
Posts: 8
Reputation: 241

Post » Mon Oct 31, 2016 9:59 am

Competitors ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Nov 10, 2016 11:52 am

99Instances2Go wrote:Competitors ?


Yes like Intel, AMD and nVidia, they will compete with you to make the best hardware.
B
5
Posts: 8
Reputation: 241


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 53 guests