This site requires JavaScript, please enable it in your browser!
Greenfoot back
mohamed.talaat99
mohamed.talaat99 wrote ...

2014/1/20

move actor

mohamed.talaat99 mohamed.talaat99

2014/1/20

#
move (1) move right move(-1) move left i need to move actor up and down How ? thanks
Super_Hippo Super_Hippo

2014/1/20

#
move(int distance) Move this actor the specified distance in the direction it is currently facing.
If you just want to move up/right/down/left, you can use
setLocation( getX() /* +/- to move right/left */ , getY() /* +/- to move down/up */ );
Super_Hippo Super_Hippo

2014/1/20

#
Super_Hippo wrote...
move(int distance) Move this actor the specified distance in the direction it is currently facing.
If you just want to move up/right/down/left, you can use
setLocation( getX() /* +/- to move right/left */ , getY() /* +/- to move down/up */ );
Otherwise you have to turn your object first and then move it.
turn(90);
move(1);
mohamed.talaat99 mohamed.talaat99

2014/1/20

#
thanks for reply me Super_Hippo i need a method to move actor up and down by using move not setlocation thanks
Super_Hippo Super_Hippo

2014/1/20

#
You could modify the move() method. Or you turn your object like I said and move it then.
mohamed.talaat99 mohamed.talaat99

2014/1/20

#
ok thank you i understand you make turn first after that move actor thank you Super_Hippo
You need to login to post a reply.