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

2016/8/31

removeTouching method

SATH8888 SATH8888

2016/8/31

#
hello. i am a beginner and i a trying to use simple methods to remove an object when it is touched by another. i have tried isTouching and removeTouching but it gives me incompatible types error. can anyone tell me the right way to use this method??? thanks in advance.
Super_Hippo Super_Hippo

2016/8/31

#
Show how you used it.
danpost danpost

2016/8/31

#
SATH8888 wrote...
i a trying to use simple methods to remove an object when it is touched by another. i have tried isTouching and removeTouching but it gives me incompatible types error. can anyone tell me the right way to use this method??? thanks in advance.
In a simple variable assignment line like the following:
VarType varName = methodName();
The return type of 'methodName', or any literal, or the result of any expression evaluated on the right side, must be of type 'VarType'. If the method returns a boolean value, which the method 'isTouching' does, then that value cannot be placed into a variable whose type is not boolean. If they do not match, then you will get the 'incompatible types' error.
You need to login to post a reply.