I'm currently working on a game where you collect items from different areas in a map. I have around 10 spots on the map where I want items to be, but I feel like only 6 or so should actually have items in them when playing as so to create some mediocre replay value. I'm currently detecting the spots using map flags, and sending that data to a function in which I'll create an entity spawner. However I dont know how I can create these exceptions in the code when generating where the items go, does anyone have any hints or ideas for solutions to this problem?
here's an idea: when reading the map, add each of the locations to a table. After you've read the whole map and have all the locations in that table, randomly remove 4 or so locations from the table. Then iterate through the table and spawn an item in each location.
@kittenm4ster That idea is so simple yet efficient! I love it! I hadn't actually worked with tables at all yet in Pico8, but I just spent the last hour researching them. The only problem I ccan find with it is that the delete function for tables only works with direct values, and not their index/position within the table. I have an idea of how to work around this, I'll probably just individually input the locations instead of using map flags. Thanks so much for the idea! Cant wait to get home now and try it out!
@kittenm4ster Glad to report that it works! Currently grabbing 10 locations and randomly shortening the last to 6. Havent worked out a spawning function yet as it's gonna get a bit messing trying to integrate it with Zep's collision code, but I think the hardest part is out of the way. Thanks so much for your help!
[Please log in to post a comment]