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

What is happening right now?

Yehuda

reply to I NEED IMMEDIATE HELP

By Yehuda - 29 minutes ago
The CountingCycles class is an Actor which has to be added to the world for its code to run. If you want the score to decrease by one every 60 act cycles then put the code from the CountingCycles class into your World subclass. <Code Omitted>
Yehuda

reply to code doesn't work

By Yehuda - about 1 hour ago
There is somewhere in your code that you call this method after you removed the bullet2, you can only call a method like this if getWorld() != null. Which means the actor has to be in the world.
Yehuda

reply to Health Bar Problems

By Yehuda - about 1 hour ago
I don't see very much subtracting here. Each 'feuer' has it's own bar, the 'feuer' moves left and when it hits Main or the world edge it gets removed so there is not much time for bars to decrease. Your code seems to be a bit messy. You should change it to this: <Code Omitted>With this code the bar will stay right on top of the actor, if you want to have one stationary Bar then you shouldn't create the bar in 'Feuer', you should create it in a World then access it from 'Feuer'.
Yehuda

reply to Adding smoke to Object on Collision

By Yehuda - about 2 hours ago
Either you have an instance of the Object that you want the smoke to follow then you can get the x and y of the actor for the smoke, or you check for an intersecting object and then set your x and y to those of the intersecting object (which basically is the same as the first way since your getting an instance of it with the method).
Yehuda

reply to Code to make a number gradually grow

By Yehuda - about 2 hours ago
Your addScore method increases the score. Whenever you want to increase the score call that method. If the way you want the counter to work is that the whole game it just continually increases as opposed to every time something happens, then just put 'score++' in the act and delete the addScore method since you're anyway constantly increasing it.
Yehuda

reply to hi, for some reason this code isnt doing exatly what i want

By Yehuda - about 2 hours ago
I don't think it's necessary to have an 'if' which checks the value of a variable, if the previous line sets the variable. So checking the rotation is useless since you know that it's 180. Since you have the flipping code and movement code in the same place, every time you want to move, the image will flip with that. So you should only flip the image when you switch directions, instead of constantly flipping the image while moving/pressing 'A'.