lionz's Recent Forum Activity

  • You are adding it to a loop but the wrong loop, you need to create a new one as a sub event at the point in time where you need to convert all numbers to int.

  • Hmm again the actions are not added into the loop I mentioned. You should create a new for loop, for from 0 to array.width and add those actions.

  • In a collision or overlap event you can make use of system Pick nth instance, where instance 0 and instance 1 are the two involved in the event.

  • Alright no problem. And just to clarify my first few responses on here are in reference to saving or storing that data. So the tilemaps you are drawing to create the racetrack, you can save the tile positions as a string of data, that's what I originally thought you meant by reusing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you go to the layout during runtime then yes.

  • By full array I meant all the data available not that it must be full of scores. You can sort it whenever you want but I guess after adding all data which I assume you do on start of layout? I also thought you had done sorting already because you mentioned it earlier? There is an array sort which puts them from lowest to highest, you use this, then you use array reverse to put them highest to lowest.

    As for the int conversion, i said to put it inside a for loop. All this logic can go within the other event you had for filling the array as long as its done after. You use a for loop to run through all scores in the column and convert them to int. You can do this on a button click but you need to add the for loop as mentioned above as a sub event otherwise loopindex does not mean anything.

  • It's fine to use an array for tracking but my point is if you use instance A and instance B of farm, you will still be using variables so the array is just for holding all the data. The idea is on creation of the building you set the array identifier to 1, then increase it in general by 1 (this would be a global variable to compare against), so when you create the next farm the identifier is 2. The identifier links to a row in the array so you can have all buildings in there. As for a log of the days activities you could total up a column of units produced etc

  • Oh yeah that was the issue, sorting. It's been a while so I had forgotten.

    Yes the array needs to be full first, do you know where that logic is and when it has all the data?

    Once full I would use something like this to convert back to int, this logic assuming Y=0 and Y=1 are values to turn back to int :

    System for from 0 to array.width : array set value at xy(loopindex,0) to int(array.at(loopindex,0))

    System for from 0 to array.width : array set value at xy(loopindex,1) to int(array.at(loopindex,1))

    That should convert all the string numbers to ints that can be properly sorted

  • Adjusting the layers to be consistent was only a possible fix for the player appearing behind objects, is that fixed now? You didn't mention it. The extra objects appearing, there is probably a simple reason but it's only speculation without seeing the file.

  • Not sure if array is totally required for this although it could act as a way to view all data. In the end you will be pulling variable data into the array and those variables would be good enough. So a farm would have production type which is a string variable, number of stored or created products, production time/speed as number variables etc.

    If I was to put all this data in an array, what you can do is give each building an identifier which is the position or row in the array. Then with logic you link up the building's values to the array, so type = array.at(building.arrayposition,0), production time = array.at(building.arrayposition,1). This would allow all buildings to put their data into the array with very little code.

    Also I would advise putting all buildings into a buildings family for this, so you do not have duplicate code referencing different buildings, farm.arrayposition,0 and mill.arrayposition,0 become building.arrayposition,0 if you use families and family instance variables to group them.

  • Now that I think about it some more you might not have to convert them to int, should just display fine as they are in the array? You just need to put the text logic separately without the int.

  • So it's a guessing game? Level 2 probably has fewer layers so the player moves to a lower layer and is behind objects. The extra objects are either because you added them in the level 2 layout (you shouldn't if objects are global as they continue through), or you have logic that creates the player and crosshairs 'on start of layout' which you also don't need if the objects are global.

lionz's avatar

lionz

Member since 5 Aug, 2013

Twitter
lionz has 75 followers

Trophy Case

  • 11-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

24/44
How to earn trophies