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

2014/10/24

turn one way or another

11770 11770

2014/10/24

#
i tried turn(45||-45) but that just throws me a bad operand type for binary operator error
GUARDIAN-X GUARDIAN-X

2014/10/24

#
What exactly are you trying to do with this particular code?
Super_Hippo Super_Hippo

2014/10/24

#
You can't write it like this. Instead, you can create a new random number and 50% of the time, you turn clockwise and 50% counterclockwise.
if (Greenfoot.getRandomNumber(2)==0) turn(45);
else turn(-45);
You need to login to post a reply.