This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
JasonZhu
wrote ...
2014/1/9
How to call a public method from the World from an Actor
JasonZhu
2014/1/9
#
I have a World named Table and I would like to use a method that I made public in the Table class from another Actor class. How is this done?
Gevater_Tod4711
2014/1/9
#
If the actor is in the world you can use this code:
?
1
2
//in your actor subclass:
((Table) getWorld()).methodName();
JasonZhu
2014/1/9
#
Okay, thanks. I knew I had to cast Table to getWorld(). I guess when I was doing it, my brackets were in the wrong place then I lost my hope in it working.
You need to login to post a reply.
X