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

2014/11/8

I cannot understand paint method in greep scenario

songgh1999 songgh1999

2014/11/8

#
i think i should set up paint method with spit method to drop paint but i can't do can you give me a hint?
danpost danpost

2014/11/8

#
I did not think there was a 'paint' method in the greeps scenario. There is a Paint class, which is the actor object that a greep creates when it spits and this class would have a Paint constructor. And, there is a 'spit' method which will have a greep spit a drop of paint (a Paint object) on the ground. Maybe you need to rephrase what you are trying to do (or be a bit more specific).
songgh1999 songgh1999

2014/11/9

#
oh, i confused class and method i mean i want greeps to spit paint but i cant understand spit method. i'm totally beginner so i want some examples or scenarios that use spit method
danpost danpost

2014/11/9

#
All you need do is put something like the following in the act method of the Greep class for a greep to spit:
1
2
3
spit("red");
// or
spit("orange");
You will probably want to put a condition on calling it, however, using an 'if' clause to regulate it.
You need to login to post a reply.