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

2013/12/18

Tutorial Help

StructuredLight StructuredLight

2013/12/18

#
I'm lost in paragraphs 7-9 of Tutorial 3: Detecting and Removing Actors, and Making Methods. Besides the remove object method, I don't get how anything in those paragraph's and the corresponding code applies to the program. I tried hard to understand, but I don't think the author explained thoroughly enough. He didn't explain what the return value is. Any help would be greatly appreciated because I'm stuck.
danpost danpost

2013/12/18

#
You may want to check out the Java Lesson on Classes and Objects which deals with creating methods. Maybe you will understand it better after that.
davmac davmac

2013/12/18

#
He didn't explain what the return value is
I guess you're referring to this bit:
Note that we're not only calling the method, we're doing something on the left-hand side, too. This method returns something (the object underneath us, if there is one), so we need to store this return value ready to use it again
The return value of a method is the value which the method returns. Some methods don't return anything, but others do - for instance, getOneObjectAtOffset(...) returns a reference to the object it found (if any) or null if there was no object. Having a reference to an object means you can then do things with it (call methods on it, use it as a parameter to other methods).
StructuredLight StructuredLight

2013/12/20

#
Okay thanks I understand it a little better now
You need to login to post a reply.