I'm using an array to store levels and calling these out to a menu page using a foreach loop - all working fine so far.
So how do I make these dynamically spawned sprites (which are within a foreach loop) into:
A. Touch events
B. How do I make them pass values to the next layout
Develop games in your browser. Powerful, performant & highly capable.
Ok I got it.
What I did was:
1. Removed calling the levels from an array as the levels were going to be numbered anyway. So I just created a global variable called "totalNumberlevels" and used a for loop to print each button
2. Assign a global variable "levelSelected"
3. Used on clicked get the UID instance of the button and passed this to the global variable "levelSelected"
Works a treat.
Onwards and up.....