To further explain the two digits:
frame 0
frame 1
frame 2
frame 3
frame 4
frame 5
frame 6
frame 7
frame 8
{start} Starts in the any frame you want. On my exemple above, it will start in the frame 1 (because I have a code in the first frame which I don't want to be looped).
{end} Ends in the frame you specific but, opposite of all other settings in OpenBOR, you should use the
frame count and not the frame number. On the example bellow, we have 9 frames.
If you want the loop reach the end, you should not use "loop 1 1 8" but "loop 1 1 9". If you use OpenBORstats, you can use the number it display bellow the frame in the animation editor.
In other words, it tells that the loop will end in the frame you set, so the loop will be valid until the frame before.
Here is my code:
anim idle
loop 1 1 9
offset 1 1
delay 3
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/chars/misc/bgfx/bg1.gif
@cmd changeentityproperty getlocalvar("self") "setlayer" -2000
frame data/chars/misc/bgfx/bg2.gif
frame data/chars/misc/bgfx/bg3.gif
frame data/chars/misc/bgfx/bg4.gif
frame data/chars/misc/bgfx/bg5.gif
frame data/chars/misc/bgfx/bg6.gif
frame data/chars/misc/bgfx/bg7.gif
frame data/chars/misc/bgfx/bg8.gif
frame data/chars/misc/bgfx/bg1.gif
Notice that I have script in the first frame (frame 0 - bg1.gif) that I don't need to make the engine to execute it in each loop. But in the second frame (bg2.gif), I have a code that I DO need to be executed in each loop (because the engine will ignore this in the second time the entity is spawned). Now see the last frame - its the same sprite of the frame 0 (bg1.gif), to make the loop smooth.
If you set the wrong loop frame, you can have weird results specially when you have a LANDFRAME. Take a look at Spiderwoman's shock animation (I will omit the scripts to make it easier to undestand):
anim shock
loop 1 1 5
landframe 5
delay 3
offset 240 217
frame data/chars/spider-woman/hit08.gif
drawmethod tintmode 2
drawmethod tintcolor 0_0_0
sound data/sounds/shock.wav
frame data/chars/spider-woman/hit08.gif
nodrawmethod
frame data/chars/spider-woman/hit08.gif
drawmethod tintmode 1
drawmethod tintcolor 255_255_255
frame data/chars/spider-woman/hit08.gif
nodrawmethod
frame data/chars/spider-woman/hit08.gif
delay 10
frame data/chars/spider-woman/hit10.gif
frame data/chars/spider-woman/hit11b.gif
Notice that I have a loop in the middle of the animation and I am using a landframe. She waves her hair while in the air, looping the animation, and ends when she touches the ground.
The loop end should be the same frame of landframe.
I hope this is easy to understand.
Tried the in titlescreen one, but nothing happens.
The code for menu and title are different. If you want to use a different entity for title and menu screens, you would need to customize the code.
If you are trying to learn scripts, my suggest is - try to understand the script and not just copy and paste. This will help you to build your own scripts later.