mindstorm8191 / danidle

Factory Idle style game, that doesn't yet have a name. Combine basic resources to get more advanced resources, and climb up the tech ladder
4 stars 0 forks source link

Bug: Priority management doesn't work #11

Closed mindstorm8191 closed 6 years ago

mindstorm8191 commented 6 years ago

Setting the priority level on blocks doesn't work right now. I need to find a way to sort blocks in the blocklist, but the sorting function doesn't work, and I don't know why. Any help / insight would be appreciated.

mindstorm8191 commented 6 years ago

I found another example online of custom object sorting, and used that to good success. Instead of creating your own sort function that defines if one block is greater or less than another, this definition function needs its own name (I called it compare). You then need to pass the name of that function when calling sort(). See here: https://www.sitepoint.com/sort-an-array-of-objects-in-javascript/