OMG you are trying to make loop
Press space
What are you talking about? When a key is just pressed or released, thatās a ātrigger onceā eventāyou donāt need to put that logic there. But if the key is held down (or held down inverted), thatās an āupdateā event.
(Key is pressed ā executes every frame while the key is held down.)
(Key is just pressed ā executes for only one frame at the moment of pressing.)
āRepeat for eachā and āpick allā are actually two different things: one performs a single action on everythingāfor instance, all objects get the exact same coordinate (even if itās a random one)āwhereas the other processes each object individually, meaning every object can use the same expression but receive its own unique random coordinate.
Loop is is something like after end go back to start
So imagine we have 3 numbers 1 2 3
And what you want to achieve is for it to go 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
Or a song plays and when it reaches it end you want it to start from beginning
That is loop
And you just wanted to loop animations with positions
And i gave you logic for that
Iām embarrassed that I only just noticed my mistake; itās not an engine bug, itās zero-based indexingāsomething that would be obvious to anyone who writes code. I donāt understand why I didnāt spot it sooner; I had even started thinking the check belonged strictly inside the foreach loop rather than being handled via events.
I really want to create my own game, and Iām almost there: the level editor is done, level building from the scene is ready, and JSON reading is set upābut things broke during export, so Iām going to try the extension that was recommended to me. To be honest, besides including the file as a project resource, I also keep a copy next to the executable to avoid dealing with complex file access architecture; this worked fine at runtime until I compiled the build and noticedāwhile testing a variableāthat the file wasnāt loading (though I initially thought I was just trying to read it too early).
Anyway, I really appreciate your support; itās been a pleasure spending time with you all. Iām glad you didnāt leave me to deal with this problem alone or turn your backs on me when I came back for helpāthank you.![]()
You are thanking me yet you did not understand what i told you at all
What you are doing will 100% work
But you should learn to do it easier cause what i told you you will re use in many situations
Look i have this object and its 1st animation (one at index 0) have 10 frames
And we gonna use exactly that
Press and release LMB
That is exactly what you wanted to achieve
Now rundown of wtf is going on
just to be clear in both actions we use SET TO not add
1 - inside mod() expression we put ObjectName.Sprite()+1 which returns current object animation
So we take current frame of sprite and add 1 to it
For example right now sprite is at frame 3 so it reads 3 add 1 to it and we have 4
2 - here we put how many frames you have i have 10 so i put 10 in your case it would be 8
This is indicating around what number loop 1st number in expression
In other word mod(Number1,Number2)
Number1 can change but if it goes above Number2 then loop it around Number2
For example we have add 1 to variable each second
Now if you will do it in a way mod(Variable+1,60)
You just made timer counting 60 seconds
3 - default position for you i guess it would be 0 but this is like starting position to which object should return after Number1 is greater than Number2
4 - we add to it height of our object or any distance we want for object to advance
5 - Again we read current frame of our object
This way if frame is 0 then ANY number * 0 = 0
So on frame 0 thx to this formula we gonna object change position only to starting position so in my case to Ballz.Y()
And thatās all








