White Dragon
New member
I noticed that the animation up / down an enemy together with walk does not work well. That is a preference for the animation down.
So in general it is preferable to assign only the animation WALK to an enemy without the addition of up / down.
I'd rather use all four directions to an enemy.
I'd even use the animation up / down not only for its diagonal movement but I wish I could play the animation only if the enemy walking up or down (not diagonally).
I used this particular trick, but I'm sure you can do better.
ps. this animation with the animation up / down run in diagonal movement (for not diagonal get xdir == 0 + a threshold...).
So in general it is preferable to assign only the animation WALK to an enemy without the addition of up / down.
I'd rather use all four directions to an enemy.
I'd even use the animation up / down not only for its diagonal movement but I wish I could play the animation only if the enemy walking up or down (not diagonally).
I used this particular trick, but I'm sure you can do better.
ps. this animation with the animation up / down run in diagonal movement (for not diagonal get xdir == 0 + a threshold...).
Code:
anim WALK
loop 1
@script
void self = getlocalvar("self");
float zdir = getentityproperty(self, "zdir");
int ufrm = 3;
if ( zdir < 0 ) zdir *= -1;
if ( zdir >= getentityproperty(self, "speed")/2 ) {
if ( getentityproperty(self, "zdir") < 0 ) {
if ( getlocalvar("animpos") <= ufrm || getlocalvar("animpos") >= ufrm*2+2 ) {
changeentityproperty(self, "animpos", ufrm+1);
} else {
changeentityproperty(self, "animpos", getlocalvar("animpos")+1);
if ( getentityproperty(self, "animpos") >= ufrm*2+1 ) {
changeentityproperty(self, "animpos", ufrm+1);
}
}
} else if ( getentityproperty(self, "zdir") > 0 ) {
if ( getlocalvar("animpos") < ufrm*2+2 ) {
changeentityproperty(self, "animpos", ufrm*2+2);
} else {
changeentityproperty(self, "animpos", getlocalvar("animpos")+1);
if ( getentityproperty(self, "animpos") >= ufrm*3+3 ) {
changeentityproperty(self, "animpos", ufrm*2+2);
}
}
}
} else {
if ( getlocalvar("animpos") > ufrm+1 ) {
changeentityproperty(self, "animpos", 0);
} else {
changeentityproperty(self, "animpos", getlocalvar("animpos")+1);
if ( getentityproperty(self, "animpos") >= ufrm+1 ) {
changeentityproperty(self, "animpos", 0);
}
}
}
setlocalvar("animpos", getentityproperty(self, "animpos"));
@end_script
offset 22 55
bbox 17 26 24 23
delay 10
frame data/chars/mouser/2.gif
frame data/chars/mouser/3.gif
frame data/chars/mouser/4.gif
frame data/chars/mouser/1.gif
offset 24 60
bbox 15 22 20 31
frame data/chars/mouser/up2.gif
bbox 19 25 19 28
frame data/chars/mouser/up3.gif
frame data/chars/mouser/up4.gif
offset 22 60
frame data/chars/mouser/up1.gif
offset 31 55
bbox 22 27 18 25
frame data/chars/mouser/down2.gif
frame data/chars/mouser/down3.gif
frame data/chars/mouser/down4.gif
frame data/chars/mouser/down1.gif
frame none