Check if frame of an animation is a multiple of another number

Hello everyone,

I am currently working on a game where a player has to choose tiles that are a factor of a certain number on a board. In order to make the game more interesting, the majority of the tiles have to be the wrong answer by default, making the tiles that are the correct answer more difficult to weed out.

The incorrect tiles, simply named “tiles” are meant to always display a number that is not a correct answer, should never be a factor of the chosen multiple (The player gets to pick which number they want the target multiple to be). Unfortunately, the intentionally incorrect tiles seem to be ignoring the condition that if they are a multiple of the selected number, they must change to another number within the intended parameters.

I’ve tried multiple tricks on this forum in order to have something detect if one number is a multiple of another, but nothing seems to have helped so far. So, if anyone knows, I would like to know how to make my game check if the frame of a certain object, in this case being the intentionally incorrect tiles, is a multiple of a given number variable.

Here’s a screenshot of what I currently have:

In this case, the variable InGameMultiple is a number variable that the player chooses the number of, and if the frame of the tile is a multiple of that, it should execute the action on the right. Please let me know what I need to change in order to fix this, and thank you in advance.

You probably need a “for each object” event.
https://wiki.gdevelop.io/gdevelop5/events/foreach/

This is an interesting concept. Your approach is good but it relies on brute force and a bit of luck. It’s like trying to guess a password. You might get it on your first try or your 100th try.

My concept is to create an array of numbers that aren’t multiples and then choose from that array.

try me (click the button) It uses 1 button, 1 text object and the create multiple copies of an object extension. It changes the color of multiples to green for testing. It seems to work. The various ranges can be tweaked.
https://gd.games/keith_13579/random-multiples

scene variables

With the use of an array, you could also remove the child that gets picked so there wouldn’t be duplicate numbers. The array could be auto refilling in case there aren’t enough numbers. You could use a second array with the multiples and remove the child value as well. So, they don’t repeat.

The variable chance is used to create the odds. In this case 1 in 5. It could be changed to a set number using a counter but then it would need a different method of random placement.

You need to have this event
image
as a subevent of a For each object (as @davy is alluding to).

That compare 2 numbers condition does not select the tiles that are multiples of the number. It just returns true or false.