The game is built on Zep's Collide.p8 demo. I'm basically placing "Items" (Musical Note etc.) into the map at specified locations marked by Red Squares. I have a function which basically checks for the Coordinates of the Red Squares, which it stores in a table and reduces to just 6 locations which are ordered randomly each time.
The problem is that all the Item data is in _Init() and cannot be anywhere else, and the Location data is made in a function. So everytime the game loads, the Items are in the same default position in the Table which they are set to.
How can change this so the Locations are sorted and randomized first, or is there anything that can be done to fix this?
(To navigate the cart: Orange Numbers are Player Coords, Yellow Numbers are the Coords of the second Item in the "ILoc" table.)
All changes made are on tabs 0 and 1. (I commented them.)
My solution is, essentially, to place the location-clipper in the init function and remove it from the update function. I also redid the location-clipper function itself.
I made some mild edits to the actor constructors for efficiency. Most notably, iteration now builds all six items with 3 lines instead of the several needed per actor previously. I did this because I needed to be sure all six actors were receiving different positions, not merely the three present before.
All changes are on tabs 0 and 1. I have left the rest of the code completely as-is.
[Please log in to post a comment]