[Solved] Dynamic filling of the array

How to fill an array with a loop?
The code on the screen does not work …

What does it currently do? Maybe a screen shot to show what’s happening may help us understand what’s going on.


Also, this :

image

Is the same as changing the animation frame to Variable(i)

Hey!! I want to make the initial arrangement of chips with the necessary frames for further casting array

When you set the animation frame, you also need to pause the animation (of plitka).

However, you may be better off having 15 animations, with one frame each (rather than the one animation with 15 frames that you have now). then just change the animation number, and no need to stop the animation.

I agree, 15 animations with one frame is better.
But the problem is how to create a list of animations and mix it :sunglasses:

You can reference the animation by the number instead of the name :

image

Hey!
I give a link to the folder with the code.
https://drive.google.com/drive/folders/1gtTd1aEZg2zjBFZT9Y19poCwsbmevjOA?usp=sharing
Everything works, but I do not understand how to check the condition “victory”.
How to sort out an array and compare with a frame number?
If you have time help.

Sorry, just working on a few game jam submissions. I’ll have a look in a day or so.

Hey,
I try to solve through the JS code, but it is interesting to do it in the editor GD.
Thanks for the answer.

The way you’ve coded it, it’s not too difficult to get that working.

Add a new text object, PositionCheck, and add an instance of it over each plikta object :


Add the following events (after the winning conditions comment) at the end of the control group :


Change the Put in order section to be in a “Beginning of scene” event :


And finally add an action when the board is shuffled to set Victory to false and IsShuffled to true :


And that should be it. The scene variable “Victory” will be set to true when all the tiles are in their original positions.

Hey!
Thanks for the advice. A good way to bypass through the collision.
I can’t do it, although everything is clear
I am “fighting” for half a day above the mistake that I can not track …
How can you track a boolean variable un a concole

My apologies, I posted some incorrect screen shots. I’m not sure what happened there.

The object set up should include a PositionCheck object in the bottom right cell :


And the conditions were round the wrong way - Victory should be false, and IsShuffled should be true :

image

Hey! If I don’t bother you …
It will turn out so if you press the “restart”


Can place the check block after each move?
Thank you

You see the values of pos_check are 1 less than each tile that they’re over? That’s not right. The numbers should run from 0 to 15, left to right, top to bottom. The fact those numbers are not in sequence means the pos_check text values are getting set somewhere other than at the beginning of the scene.

Your put in order events are not child events of the beginning of scene. It should be. From one of my previous posts :

Hey!!
Thanks again for the algorithm.
For two days I was looking for a solution. As a result, it works for me like this:


right

wrong

Thank you for your help :sunglasses:

Good to see you got it working.


Out of curiosity - when the tiles aren’t in their correct place, does it flash grey before turning red whenever you click on a tile (for example in your last screen snip if you moved the 11 tile down)?


Also, from an efficiency point of view this :

image

would be better with a trigger once. It’s iterating through each repeat block every frame whenever the mouse or touch aren’t down. Although it’s not a biggie in this game, if you write other games and have quite a few object you iterate over, this type of programming practice could have a performance effect.

https://timely-salmiakki-f7ba9b.netlify.app/
Hello!, I had to sweat a little.
There is a result
I give a link to HTML5 :sunglasses:
The topic is solved.

1 Like

Excellent, it plays really well. It’s great to see you got it working :smiley: