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

What is happening right now?


reply to how to make my actor move slower/faster after touching something

By Spock47 - about 5 hours ago
I think additionally to the most important point danpost mentioned (no. 1), there is something off with the current act method: <Code Omitted>2. In the foundBug method, the bug gets already removed from the world, so when calling the eatBug method the bug is not there anymore to be eaten. I assume that your score currently only increases, if you touch two bugs at the same time (because foundBug removes one bug, so eatBug only rewards a score point, if there is another bug). 3. The speedTimer mechanism (counting down) is also only called in the moment, where a bug is found: So, foundBug finds a bug, sets the speedTimer at 10, then the inner if reduces the speedTimer to 9, but after that the inner if will never be called again (unless another bug is found, in which case the speedTimer will be reset to 10 before the inner if is called). So, I guess the speedTimer will always be at 9 or 10 (or 0 at the start). 4. Your act method has a parameter, but the act method that Greenfoot will call, does not have a parameter, so it will not call your act method. Possible solution: 1. In foundBug, replace line 70 (removing the bug) with "eatBug();" 2. Replace the act method with: <Code Omitted>(3. Change the return type of foundBug to void, if you want.) Additional note: The moveAround method currently has a parameter "speed", too. But you already have an attribute "protected int speed". You can use the attribute, so you don't have to give the speed as a parameter to the method. Live long and prosper, Spock47

reply to Random spawn enemy

By danpost - about 10 hours ago
Either (for left side): <Code Omitted>or (for right side): <Code Omitted>

reply to Method depending on the world youre in

By HighIqE - about 12 hours ago
ty very much man.

reply to World doesn't display text although code is correct - why?

By danpost - about 15 hours ago
And what codes do you have in the Next class?