Hblade wrote:hehe, dont worry link, I'll help as much as possible
I'm not sure if this will work, but try using this:
- Code: Select all
if (animpos == 0)
{
ChangeAnimation
}
if (animpos == nframes)
{
animpos = 0;
}
But put it with the if (x<hero.x) and stuff, so put it under the x+=4; and remove the old ChangeAnimation
if(x>hero.x){
if(animpos == 0{
ChangeAnimation("Event Actor", "mon1walkleft1", NO_CHANGE);
}
if(animpos == nframes)
animpos 0 ;
}
Or like this?:
[code]
if(x>hero.x&&animpos ==0)
...
if(x>hero.x){
if(animpos == 0{
ChangeAnimation("Event Actor", "mon1walkleft1", NO_CHANGE);
}
if(animpos == nframes)
animpos 0 ;
}
}
MoveTo("Event Actor", 0.000000, 0.000000, 4.000000, "hero", "");
if(x>hero.x){
if(animpos == 0){
ChangeAnimation("Event Actor", "mon1walkleft1", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0 ;
}
}
else if(x<hero.x){
if(animpos == 0){
ChangeAnimation("Event Actor", "mon1walkright1", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
else if(y>hero.y){
if(animpos == 0){
ChangeAnimation("Event Actor", "mon1walkfront1_seq",NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
else if(y<hero.y){
if(animpos == 0){
ChangeAnimation("Event Actor", "mon1walkup1_seq", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
MoveTo("Event Actor", 0.000000, 0.000000, 4.000000, "hero", "");
if(x>hero.x){
if(animpos==0){
ChangeAnimation("Event Actor", "mon1walkleft1", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0 ;
}
}
if(x<hero.x){
if(animpos==0){
ChangeAnimation("Event Actor", "mon1walkright1", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
if(y>hero.y){
if(animpos==0){
ChangeAnimation("Event Actor", "mon1walkfront1_seq",NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
if(y<hero.y){
if(animpos==0){
ChangeAnimation("Event Actor", "mon1walkup1_seq", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
MoveTo("Event Actor", 0.000000, 0.000000, 2.000000, "player", "");
if((x>player.x)&&(x>(abs(player.y)))){
if(animpos==0){
ChangeAnimation("Event Actor", "leftarrow", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0 ;
}
}
if((x<player.x)&&((abs(x))>(abs(player.y)))){
if(animpos==0){
ChangeAnimation("Event Actor", "rightarrow", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
if((y>player.y)&&(y>=(abs(player.x)))){
if(animpos==0){
ChangeAnimation("Event Actor", "downarrow",NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
if((y<player.y)&&(abs(y))>=(abs(player.x))){
if(animpos==0){
ChangeAnimation("Event Actor", "uparrow", NO_CHANGE);
}
if(animpos == nframes){
animpos = 0;
}
}
char dirs[4]=""; //create an empty string to use for animation
angle=direction(x, y, hero.x, hero.y); //find angle to player
dir=round(angle/90); //find animation direction based on angle, where dir is a variable you made.
if(angle>315){dir=0;} //compensate for angles between 315 & 0
if(dir!=prevdir){//if our dir has changed from last frame, where prevdir is a variable you made
sprintf(dirs, "%i", dir); //write our direction to the string 'dirs'.
ChangeAnimation("Event Actor", dirs, FORWARD); //change to animation matching 'dir'.
}
prevdir=dir;
if(distance(x, y, xprev, yprev)>=4){
animpos++;
xprev=x;
yprev=y;
animpos=iLoop(animpos, 0, nframes); //see the global function for this below
}
int iLoop(int x1, int ll, int ul){
if(x1>ul){x1=ll;} //if it's greater than the Upper Limit, it = Lower Limit
else if(x1<ll){x1=ul;}//if it's smaller than the Lower Limit, it = Upper Limit
return x1;
}
Users browsing this forum: No registered users and 1 guest