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

2013/5/27

Movement?

Jin-Ho Jin-Ho

2013/5/27

#
So I have an object where I click it keeps moving But I want to make it so that when it touches another object it stops How do I make an object stop? The move command is just move(whatever number); Then to make it stop moving would it be stop(); ?
Gevater_Tod4711 Gevater_Tod4711

2013/5/27

#
If you got a stop method you can use it but it would be easyer just not to move. So if you object touches another object you don't execute the move method:
if (getOneIntersectingObject(Actor.class) == null) {
    move();
}
You need to login to post a reply.