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

2021/5/27

How to call method references

tayyabah72 tayyabah72

2021/5/27

#
How can we assume a method is an instance of a class and then write a method call to add an object referenced by the instance to the world at (200, 100) x-y coordinates I have the following scenario iv. Assume hgryWombat is an instance of HungryWombat class. Write a method call to add the HungryWombat referenced by hgryWombat to the world at (200, 100) x-y coordinates.. How can we make this code?
danpost danpost

2021/5/27

#
Maybe you are meant to write a line of code using the "addObject(Actor, int, int)" method.
tayyabah72 tayyabah72

2021/5/28

#
Thats right we are adding the object wombat in this case however i am not sure how to write it all together as one because I haven’t tried this one before.
danpost danpost

2021/5/28

#
tayyabah72 wrote...
Thats right we are adding the object wombat in this case however i am not sure how to write it all together as one because I haven’t tried this one before.
Add one manually, save the world, then look at the code in your world class (probably called MyWorld)..
You need to login to post a reply.