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

2012/5/2

Some Really Simple Stuff...

theDoctor theDoctor

2012/5/2

#
I'm forgetting how to call a method from one class into another class. I know it's simple, I just totally forgot!
nccb nccb

2012/5/2

#
The syntax is straightforward. If you want to call a method on the world, you can use:
World w = getWorld();
int width  = w.getWidth(); // object <dot> method_name ( <parameters> )
Or just:
int width = getWorld().getWidth();
The tricky bit is often knowing how to get the reference to the other object in order to call the method. This guide has some hints on that.
theDoctor theDoctor

2012/5/2

#
Thanks nccb.
You need to login to post a reply.