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

2018/6/30

Help with isAtEdge() method

Catw24 Catw24

2018/6/30

#
Hello I'm currently working on the labyrinth problem for my final exam in computer science at school. So I wanted that when my actor reaches the edge he should turn and then move forward but he's kind of stuck at the edge. It seems like it doesn't matter if he's facing the edge or not. If any part is next to the edge he'll just keep turning. Is there some way to modify this method because I literally have no idea as I'm pretty new to this. Thanks in advance
danpost danpost

2018/6/30

#
Catw24 wrote...
I wanted that when my actor reaches the edge he should turn and then move forward but he's kind of stuck at the edge. It seems like it doesn't matter if he's facing the edge or not. If any part is next to the edge he'll just keep turning. Is there some way to modify this method
Use dual conditions for turning. Check at edge state and the rotation of the actor to determine whether to turn or not.
You need to login to post a reply.