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

2024/2/5

Making A Method

Kookaburra737 Kookaburra737

2024/2/5

#
Hey! I'm new to using Green Foot and I'm having trouble understanding how to make a method, I've been watching the help videos but every time I try to use some code like: if (canSee(Avatar.class)) { eat(Avatar.class); } It tells me I haven't declared the methods yet (eat & canSee), I don't understand how to declare the method... Please help me.
danpost danpost

2024/2/5

#
Kookaburra737 wrote...
Hey! I'm new to using Green Foot and I'm having trouble understanding how to make a method, I've been watching the help videos but every time I try to use some code like: << Code Omitted >> It tells me I haven't declared the methods yet (eat & canSee), I don't understand how to declare the method... Please help me.
Instead of eat and canSee (which are Animal class methods), use removeTouching and isTouching (which are Actor class methods).
Kookaburra737 Kookaburra737

2024/2/5

#
Thank you so much!
You need to login to post a reply.