Does anybody know how to make a menu have random options? I’m making a game and part of it needs to have a menu that has random options in it that the code chose from an array or something. (thats how I think it should work)
1 Like
here you go its simple enough for you to understand how it works
2 Likes
function createSmallerRandomArray (menuItems: any[], itemCount: number, repeat: boolean) {
let temporaryArray = menuItems
let returnedArray = []
for (let index = 0; index < itemCount; index++) {
if (temporaryArray.length <= 0) {
break;
} else {
let randomNum = randint(0, temporaryArray.length - 1)
returnedArray.push(temporaryArray[randomNum])
if (!(repeat)) {
temporaryArray.removeAt(randomNum)
}
}
}
return returnedArray
}
Here’s a function I created for you! It’s customizable by a bit might I add.
For it to work you must install the
riknoll/arcade-mini-menu
extension.
Here’s an example:
1 Like
thats strange, i copied the exact code and i got an error
this is happening and idk why since I copied straight from @TheEarth s code
2 Likes
remove the big green thing that says create menu sprite from
2 Likes
Thanks! It worked!

