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

2016/3/16

What code would I used to have an object (named Mito) eat another object (FishFoodPellets)?

alexus2514 alexus2514

2016/3/16

#
My textbook isn't too helpful.
alexus2514 alexus2514

2016/3/16

#
The code example I was given is: Actor actor = getOneObjectAtOffset(0, 0, clss); if(actor != null) { getWorld().removeObject(actor); } } But when trying to use it, greenfoot said there were errors. Why?
danpost danpost

2016/3/16

#
Unless you assign some value to the variable 'clss', or replace it with the actual class that you are trying to get at that offset ('FishFoodPellets.class'), you will continue to get errors.
alexus2514 alexus2514

2016/3/16

#
An error keeps appearing saying that I need an ";" between "FishFoodPellets" and "!" how can I fix that?
DogeOverlord DogeOverlord

2016/3/17

#
'actor' is a variable name. Leave that alone. You need to change 'clss' to 'FishFoodPellets.class', or whatever the name of the class is you are trying to eat.
You need to login to post a reply.