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

2015/8/10

how to check if actor is on edge.

Francis1004 Francis1004

2015/8/10

#
guys help me out please, i need to know how the actor moves backwards after hitting the edge of the world automatically.
Francis1004 Francis1004

2015/8/10

#
Guys? please help i need for my school project. and im a newbie here.
danpost danpost

2015/8/10

#
You need to post the code for the class which shows how you currently have the actor moving (read the page linked to the 'Posting code? read this.' below the reply box).
Francis1004 Francis1004

2015/8/10

#
but my problem is i dont know how to use it. i dont know how to construct the code for the method. thanks by the way
danpost danpost

2015/8/10

#
Cannot help with your code without a starting point. Please post the code of the class for the actor that needs to reverse directions at an edge.
Francis1004 Francis1004

2015/8/10

#
sure wait
Francis1004 Francis1004

2015/8/10

#
public void act() { Actor lizard; lizard = getOneObjectAtOffset(0, 0, lizard.class); if (lizard != null) { World world; world = getWorld(); world.removeObject(lizard); } if(car()==isAtEdge) { move(-4); } }
danpost danpost

2015/8/10

#
Still, not enough information. I asked for the entire class code -- not just the act method. I cannot see how 'isAtEdge' is declared nor what the 'car' method does. Neither can I see any code that moves the actor when not (apparently) at the edge.
Francis1004 Francis1004

2015/8/10

#
ohhh okay thanks
You need to login to post a reply.