player.x = mousex;
player.y = mousey;
I tried using the code and it made the character keep a distace from the mouse. Like it was parented to the mouse but from the bottom right corner. (Maybe I did something wrong?)Thanx wrote:Draw Actor event:
player is the actor
- Code: Select all
player.x = mousex;
player.y = mousey;
if (x < xmouse - 30 && y < ymouse - 30)
{{ ChangeAnimation("Event Actor", "ld", FORWARD);}}
else
if (x < xmouse - 30 && y > ymouse + 30)
{ ChangeAnimation("Event Actor", "ul", FORWARD);}
else
if (x > xmouse + 30 && y > ymouse + 30)
{ ChangeAnimation("Event Actor", "ru", FORWARD);}
else
if (x > xmouse + 30 && y < ymouse - 30)
{ ChangeAnimation("Event Actor", "dr", FORWARD);}
else
if (xmouse < x && ymouse < (y + 30) && ymouse > (y - 30))
{ ChangeAnimation("Event Actor", "r", FORWARD);}
else
if (xmouse > x && ymouse < (y + 30) && ymouse> (y - 30))
{ ChangeAnimation("Event Actor", "l", FORWARD);}
else
if (xmouse < (x + 30) && xmouse > (x - 30) && ymouse > y)
{ ChangeAnimation("Event Actor", "d", FORWARD);}
else
if (xmouse < (x + 30) && xmouse > (x - 30) && ymouse < y)
{ ChangeAnimation("Event Actor", "u", FORWARD);}
xvelocity = -5;
xvelocity = -5;
yvelocity = -5;
yvelocity = 5;
xvelocity = -5;
yvelocity = -5;
xvelocity = 5;
yvelocity = -5;
yvelocity = -5;
yvelocity = 5;
yvelocity = 5;
yvelocity = 5;
Users browsing this forum: No registered users and 1 guest