I'm trying to do some movement...not working.
How do you use move(), and am I using the scripts right...and wil this make it easier to attack the baddy?
PHP Code:
if(this.mode==1)
{
setcharani("walk",NULL);
if(!onwall(x+1+vecx(dir)*this.speed,y+1.5+vecy(dir)*this.speed))
{
x=x+1+vecx(dir)*this.speed;
y=y+1.5+vecy(dir)*this.speed;
}
if(abs(player.x-x)>abs(player.y-y))
{
//direction should be 1 or 3
if(player.x>x)
{
dir = 3;
}
else
{
dir = 1;
}
}
else
{
//direction is 0 or 2
if(player.y>y)
{
dir = 2;
}
else
{
dir = 0;
}
}
if((abs(player.x-x)^2+abs(player.y-y)^2)^.5<=3)
{
if(this.hit==1)
{
setcharani("sword",NULL);
this.hit = 0;
setTimer(.45);
}
else
{
this.hit = 1;
setTimer(random(.05,.3));
}
}
else
{
setTimer(.05);
}
}