Your MyDog class has an empty act() method, so put just one of the Dog objects in your world, and the rest must be objects of the class MyDog. If you do that, just one dog will move.
I did the other way around but I got it to work. Next step: I am to get the dog to greet the other dogs with a dance. I know how to make the dog dance and how to get it to the other dogs. I have not yet been able to get the words that the compiling will accept.
A new version of this scenario was uploaded on Sun May 06 15:07:26 UTC 2012
Need help in learning how to code. Definitions of terms are not clear yet.
I still have not been able to get myDog to greet another dog an then stop on its own. myDog will dance and then stop when the dance() method is invoked but not when is is brought on by greeting the other dogs. What method should I use to correct this? an if/else statement?
A new version of this scenario was uploaded on Fri May 11 19:42:19 UTC 2012
myDog now stops after it is done greeting dog.
How do I know if this works other than it will compile?
private int countSteps = 0;
{
for (int counter = 0; counter < 1; counter++)
{
countSteps = countSteps + 1;
if (countSteps == 30)
{
energy--;
countSteps = 0;
}
}
}
2012/5/6
2012/5/6
2012/5/6
2012/5/6
2012/5/6
2012/5/6
2012/5/6
2012/5/7
2012/5/11
2012/5/11
2012/5/11
2012/5/12