random arrey

0 favourites
  • 2 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello, I am creating a game for school and I am a beginner. The principle is a kind of QTE. The player has to realize some recipes. So for example, he has to execute 4 QTE to cut the 4 elements of the pizza. After that, we move on to another recipe. For this I have listed the recipes and their ingredients in a table. I call a column (so a recipe) at random, then I call the rows (so the ingredients of the recipe) at random. The problem is that I want the ingredients to come out once each. Do you have an idea? Thank you!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could delete the column/recipe so it can't be picked again. You can use 2 arrays I guess, one that stores the original data and one that you use to pick from that gets chopped down.

    There's also something called a permutation table under AdvancedRandom plugin where it creates a set of numbers in a random order, where it would generate from 0 to array.height(number of columns). You would select advancedrandom.permutationtable(0) for the first recipe and then (1) and so on.

    If you mean that you want ingredients to come out one at a time then you could have the column/recipe and run through each row, or if you mean randomly pick one at a time then you can create permutation as mentioned above for number of rows/ingredients.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)