Hello there,
So, after many many months of getting up at 4am and plenty of help from djaydino and the Playmaker forum, I'm finally reaching the finishing line with the core gameplay mechanics of my spaceship game.
I have one final challenge before the gameplay loop is complete, and then I can move on and focus on refining visuals in Shader Graph & VFX Graph.
I've been putting this final challenge off, because I looked into it before and it kinda fried my brain... actually, 99% of what I've done has fried my brain and if it wasn't for the help I've received here I'd have given up a long time ago.
The final challenge
In my game, you are tasked with harvesting 'shiny stuff' (crystals, gold, fairy dust, whatever) from 'sentient beings' that float around near the surface of the planet. When you find these sentient beings you start shooting them and they accelerate away from you at high speed. You chase them, guns blazing until they explode and release a load of the Shiny Stuff that you fly through to collect, and take back to the Mother Ship for your evil corporate masters.
The challenge is that I want to instantly spawn a load of Shiny Stuff (prefabs, pooler spawn?), but the amount of Shiny Stuff varies depending on a simple variable; the altitude at which you destroyed the Sentient Being.
Basically, the closer you are to the planet's surface as you're whizzing along, the higher the reward because there are more obstacles and hazards that can destroy you. If you destroy the Sentient Being at high altitude, it's much easier so the reward should be lower.
I'm thinking the way forward with this, is to load the prefab of the Shiny Stuff into an array of say, 10 objects, and then when the Sentient Being is destroyed I somehow pooler spawn from the array, the corresponding number of Shiny Stuff. Let's say, it spawns all 10 if you're really close to the ground, and it only spawns 1 or 2 if you're high up.
I've really tried to solve this on my own, but I can't get it. I've watched djaydino's Jinxter Games Youtube videos, which are great, but I can't make the connection between what the videos are showing and how to implement the techniques in my game.
It got me thinking; how do you spawn a pooled prefab into an array, but not the scene, and then that array is used to spawn the prefabs into the scene?
I set up an array variable, size 10, array type Game Object and dragged the same prefab (Shiny Stuff) into each of the 10 slots in the array variable, but what on earth do I do with it?
To be honest, the Array maker framework looks awesome, and I can understand the power of using arrays, but there are so many Playmaker actions for it, I simply don't know where to begin.
djaydino, if you're reading this, please please can you help me?
Thank you. Again.
J.