# Need a translator!

**URL:** <https://forum.kirupa.com/t/need-a-translator/326534>\
**Category:** flash\
**Created:** [December 21, 2011, 3:27pm UTC](https://forum.kirupa.com/t/need-a-translator/326534 "2011-12-21T15:27:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolz666](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@lolz666](https://forum.kirupa.com/u/lolz666)\
**Post date:** [December 21, 2011, 3:27pm UTC](https://forum.kirupa.com/t/need-a-translator/326534/1 "2011-12-21T15:27:50Z")

</div>

I’ve got this code for RTS-like movement in flash, but its AS3. I only know AS2, so i would be very thankful if any of you took your time to translate this to work on a movieclip.

```auto
[COLOR=#330099]var iswalking = false;[/COLOR]
var goX = char.x;
var goY = char.y;
var movespeed = 5;
var dir = "down";
stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(Event){ 
 if (iswalking == true) {  
char.w.play(); 
} else {  
char.w.gotoAndStop(1); 
} 
char.gotoAndStop(dir); 
 if ((goY-movespeed)>char.y) {
  char.y += movespeed; dir = "down"; 
} else if ((goY+movespeed)<char.y) { 
 char.y -= movespeed; dir = "up"; 
} if ((goX-movespeed)>char.x) { 
 char.x += movespeed; dir = "right"; 
} else if ((goX+movespeed)<char.x) {
  char.x -= movespeed; dir = "left"; 
} if ((goY-movespeed)>char.y || (goY+movespeed)<char.y || (goX-movespeed)>char.x || (goX+movespeed)<char.x){ iswalking = true; 
} else {  
iswalking=false  
}
}
stage.addEventListener(MouseEvent.CLICK, setposition);
function setposition(MouseEvent){ 
goX=mouseX 
[COLOR=#330099] goY=mouseY
}[/COLOR]

```

This is the code.

-lolz666
