Offset moving

mtrain

New member
Is there a chance to somehow edit script for dasher, but replace it with x and y coordinates of frame offset instead of x,y,z coordinates?

void dasher( float Vx, float Vy, float Vz )
{// Dash with desired speed!
    void self = getlocalvar("self");
    int dir = getentityproperty(self,"direction");

    if(dir==0){ // Facing left?
      Vx = -Vx ;
    }
    changeentityproperty(self, "velocity", Vx, Vz, Vy); //Move!
}

The problem is in next:
I try to make moving decorations, like elevator backgrounds, moving buildings on the bike stages. And to achieve moving effect of entity from right to left or from up to down i was adding about 30 frames and each one have its own offset like next:

anim follow1
loop 0
#wait----
delay 10
offset 0 2160
frame data/chars/misc/72/72_01.gif
#wait----
delay 15
offset 0 2145
frame data/chars/misc/72/72_01.gif
offset 0 2130
frame data/chars/misc/72/72_01.gif
offset 0 2115
frame data/chars/misc/72/72_01.gif
offset 0 2110
frame data/chars/misc/72/72_01.gif
offset 0 2085
frame data/chars/misc/72/72_01.gif
offset 0 2070
frame data/chars/misc/72/72_01.gif
offset 0 2055
frame data/chars/misc/72/72_01.gif
offset 0 2040
frame data/chars/misc/72/72_01.gif
offset 0 2025
frame data/chars/misc/72/72_01.gif
offset 0 2010
frame data/chars/misc/72/72_01.gif
offset 0 1995
frame data/chars/misc/72/72_01.gif
offset 0 1980
frame data/chars/misc/72/72_01.gif
offset 0 1965
frame data/chars/misc/72/72_01.gif
offset 0 1950
frame data/chars/misc/72/72_01.gif
offset 0 1935
frame data/chars/misc/72/72_01.gif
offset 0 1920
frame data/chars/misc/72/72_01.gif
offset 0 1905
frame data/chars/misc/72/72_01.gif
offset 0 1890
frame data/chars/misc/72/72_01.gif
offset 0 1875
frame data/chars/misc/72/72_01.gif
offset 0 1860
frame data/chars/misc/72/72_01.gif
offset 0 1845
frame data/chars/misc/72/72_01.gif
offset 0 1830
frame data/chars/misc/72/72_01.gif
offset 0 1815
frame data/chars/misc/72/72_01.gif
offset 0 1800
frame data/chars/misc/72/72_01.gif
offset 0 1785
frame data/chars/misc/72/72_01.gif
offset 0 1770
frame data/chars/misc/72/72_01.gif
offset 0 1755
frame data/chars/misc/72/72_01.gif
offset 0 1740
frame data/chars/misc/72/72_01.gif
offset 0 1725
frame data/chars/misc/72/72_01.gif
offset 0 1710
frame data/chars/misc/72/72_01.gif
offset 0 1695
frame data/chars/misc/72/72_01.gif
offset 0 1680
frame data/chars/misc/72/72_01.gif
offset 0 1665
frame data/chars/misc/72/72_01.gif
offset 0 1650
frame data/chars/misc/72/72_01.gif
offset 0 1635
frame data/chars/misc/72/72_01.gif
offset 0 1620
frame data/chars/misc/72/72_01.gif

So entity stand on one place but offset is changing and it makes effect of moving, but it looks "laggy" even if to add more frames, but if i add about 100 frames it is difficult to set all frames offsets manually for each frame. So i tried to make next:

anim follow1
loop 0
#wait----
delay 10
offset 0 2160
frame data/chars/misc/72/72_01.gif
#wait----
delay 17
@cmd dasher 0 0 0.513
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
frame data/chars/misc/72/72_01.gif
@cmd stop
frame data/chars/misc/72/72_01.gif

With this method i can define so many frames as i want and correct the movement by changing dashing speed. With this method i can achieve a smoothness (looks great) but entity moves too. So i cant make it looped, because i need somehow to make entity come back to it previous position.

So, a script that will allow me to change offset of the entity smoothly like dasher script will help me a lot. Or maybe you guys have another solutions?
 
For this purpose I usually use 2 entities. One is the visible one containing image of wall or background you want to 'animate' and the other is invisible one shooting the former.

Yes shooting, since it's using script, I can control shooting speed and thus control speed background moves. The tough part in doing this is to synch it so when the next background is shot it is stickied to previous one

That's the trick I used in Contra mod in levels where player is moving up or down.
 
For this purpose I usually use 2 entities. One is the visible one containing image of wall or background you want to 'animate' and the other is invisible one shooting the former.

Yes shooting, since it's using script, I can control shooting speed and thus control speed background moves. The tough part in doing this is to synch it so when the next background is shot it is stickied to previous one

That's the trick I used in Contra mod in levels where player is moving up or down.

Yes, agree, i make the same yesterday and it is work good enough.  ;)
 
Back
Top Bottom