메타버스 프로그래밍/레드브릭(redbrick)
2.레드브릭(redbrick) 오크가 검사 위치로 이동하기
파아란기쁨1
2022. 9. 22. 12:59
반응형
var move = 1;
//say("test",1)
while(true){
if (move = 1){
var luke = getSprite("luke")
var x = luke.getX()
var y = luke.getY()
var curX = getX()
var curY = getY()
var move = 50
if(curX<x)
{
setVelocityX(move)
playAnimation("front_walk",true)
}
else if(curX>x)
{
setVelocityX(-1 * move)
playAnimation("back_run",true)
}
else setVelocityX(0)
if(curY<y) setVelocityY(move)
else if(curY>y) setVelocityY(-1 * move)
else setVelocityY(0)
//say(x.toString(10) + "," + y.toString(10) + ":" + curX.toString(10) + "," + curY.toString(10),1)
}
wait(1)
}
이동 중이라면 move=1 검사의 위치(luke) 의 위치를 찾아서 그쪽 방향으로 이동하는 코드
반응형