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

2020/6/19

greenfoot functionalities

JohnBis JohnBis

2020/6/19

#
what are the functionalites?
danpost danpost

2020/6/19

#
JohnBis wrote...
what are the functionalites?
What are you referring to by "functionalities"? Give examples, maybe.
JohnBis JohnBis

2020/6/19

#
just like in wombat game, eating the leaves is the functionalites or not?
danpost danpost

2020/6/19

#
JohnBis wrote...
just like in wombat game, eating the leaves is the functionalites or not?
Methods give objects functionalities and behaviors. If you are referring to the canSee and eat methods, they are part of the Animal class which is included in the greenfoot download (you can import it and have classes extend from it). However, the Actor class now includes the equivalent methods isTouching and removeTouching, making the Animal class essentially obsolete.
JohnBis JohnBis

2020/6/20

#
thank you. and what about turn(Greenfoot.getRandomNumber(90) - 45);. i know its for turning randomly. if i change it to turn(Greenfoot.getRandomNumber(2) - 8); does it work. if yes, how?
danpost danpost

2020/6/20

#
JohnBis wrote...
thank you. and what about turn(Greenfoot.getRandomNumber(90) - 45);. i know its for turning randomly. if i change it to turn(Greenfoot.getRandomNumber(2) - 8); does it work. if yes, how?
The (90)-45 one will turn in the range { -45, 44 }, which averages out close to the current facing directtion. More accurately would be (91)-45, which would be balanced with a range { -45, 45 }. The (2)-8 one give the range { -8, -7 }, which is always turning left with hardly any variance.
You need to login to post a reply.