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

2012/10/18

run world method

HayleyG HayleyG

2012/10/18

#
I have a method in world called score and I'm trying to get Actor fish to run it. I tried World.score(); but it says "cannot find symbol - method score()"
Game/maniac Game/maniac

2012/10/18

#
Try getWorld().score();
danpost danpost

2012/10/19

#
'getWorld().score();' will not work, either. The score() method is not located in the 'World' class, but in the sub-class of World that HayleyG created. I will use 'WorldName' to refer to that sub-class of World.
((WorldName) getWorld()).score();
will access the score() method.
You need to login to post a reply.