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

2014/12/11

How would I make an actor move in a square

FelyFret FelyFret

2014/12/11

#
I want to make one of my actors move in a square, but the move and the turn command make it move in a circle. Is there anyway I could make the actors move for (x) amount of steps, and then move down (y) amount of steps and then back around? Thanks
danpost danpost

2014/12/11

#
Count the steps. When some number of steps has been completed, turn 90 degrees.
FelyFret FelyFret

2014/12/11

#
How would I count the steps? Is there a command for it? Because I went on the green foot api and I couldn't find anything
danpost danpost

2014/12/11

#
This does not deal directly with greenfoot, but with programming in the java language (which greenfoot uses). You have to add an instance int field to the class to count the steps. You should probably check out the Java tutorials, particularly the trail on Learning the Java Language. There is an abundance of information there.
FelyFret FelyFret

2014/12/11

#
thanks!
You need to login to post a reply.