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

2012/4/19

actor needs to stop another actor?

Serhil Serhil

2012/4/19

#
I have an actor named Brick and another actor named Angrybird. The actor Brick only stands in my world and the Angrybird can fly anywhere. I want that the Brick stops the Angrybird from moving when he hits it, so that when the Angrybird hits the Brick, he needs to stop and the Angrybird should go around the Brick to proceed its flight. anyone who knows how to do this? this is the movement code from my Angrybird: void move() { int speed = 10; if(Greenfoot.isKeyDown("up")) setLocation(getX(), getY() - speed); if(Greenfoot.isKeyDown("down")) setLocation(getX(), getY() + speed); if(Greenfoot.isKeyDown("left")) setLocation(getX() - speed, getY()); if(Greenfoot.isKeyDown("right")) setLocation(getX() + speed, getY()); }
You need to login to post a reply.