This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Discussions
You need to login to take part
Current Discussions
Hey
By kasperk22, with 5 replies.
Last reply by danpost, almost 13 years ago:
Are you still using 'new Rock()' to create a new rock or are you now passing the Counter object to the Rock constructor? Show the world class code as you have it now.
How to use variables from other actors
By kasperk22, with 11 replies.
Last reply by kasperk22, almost 13 years ago:
Hey... i am having trouble understanding completely what i need to do, so i created a whole new discussion to show the entire code http://www.greenfoot.org/topics/5453
counter/scoreboard please help
By JustMe, with 1 reply.
Replied to by danpost, almost 13 years ago:
What is your class structure and of what type actor are the three actors in question? Do you start with the three and there will always be the three actors until one is destroyed upon which you want the scoreboard to show?
Need help with a problem! World stops..
By Noam001, with 2 replies.
Last reply by danpost, almost 13 years ago:
You are probably getting an IllegalStateException error during the 'amIshot' method execution at the 'getOneObjectAtOffset' call (line 50) when a bullet reaches an edge of the world. This is because you call 'remove' in the act method before calling 'killZombie' which calls 'amIshot'. To use 'getOneObjectAtOffset' without getting that error, the actor must be in the world, but the 'remove' method does remove it when the bullet reaches an edge. I also noticed that you have another call to 'remove' within the 'killZombie' method. So, you could just remove the 'remove' call from the act met
High scores don't save when i export my game
By Jtlie, with 2 replies.
Last reply by Jtlie, almost 13 years ago:
I'm using the UserInfo class. What other method should I use ?<Code Omitted>
online problem
By deathburrito16, with no replies.
I put a scenario on my website, and when I try to play it, it gives me an error message, saying, ClassNotFoundException greenfoot.export.GreenfootScenarioViewer.class help
Code suddenly stopped working?
By Nooyi, with 1 reply.
Replied to by Nooyi, almost 13 years ago:
ok solved it :)
how to put game on site as flash/html imbed code
By deathburrito16, with 9 replies.
Last reply by Draymothisk, almost 13 years ago:
There may be another way to do it, but that's my way.
Enemy won't spawn
By GreenAnthony, with 3 replies.
Last reply by GreenAnthony, almost 13 years ago:
Oh f*ck now I see my mistake...!
How to apply a method to all the subclasses
By y0us, with 15 replies.
Last reply by y0us, almost 13 years ago:
Hi davmac, Thanks, but that problem is already solved. Its about adjusting the speed that the truck with the container moves away. Now it goes very fast away
How to choose an actor
By JustMe, with 1 reply.
Replied to by JustMe, almost 13 years ago:
Ow, I got what i want to do... But now i need a code that when i drag my Firetruck actor to the fire how i can get my Firetruck back to where it was when it destroys the fire. This is what i have now if (Fire !=null) { World world; world = getWorld(); world.removeObject(Fire); getWorld().addObject(new Fire(), Greenfoot.getRandomNumber(getWorld().getWidth()), Greenfoot.getRandomNumber(getWorld().getHeight())); } if(Greenfoot.mouseDragged(this)) { MouseInfo mouse = Greenfoot.getMouse
Health doesn't work!!!
By Bean4221, with 2 replies.
Last reply by Bean4221, almost 13 years ago:
ok thanks
Error when pressing "Run"
By qweasdzxc, with 1 reply.
Replied to by danpost, almost 13 years ago:
Do you have a class called 'capsule'? if so, does line 11 have a 'new GreenfootImage' call in it? if so, show the code for the act method it is in.
Need help with speed booster
By UNDEAD_DC, with 2 replies.
Last reply by lordhershey, almost 13 years ago:
I will have to take a look at it a bit later, but you might look to some of those seconds counter examples that various people have posted; check out the http://www.greenfoot.org/scenarios/4013 scenario. you can use the same mechanism to count the seconds independent of the speed set on the scenario. you can have it affect the movement speed by either setting a speed variable or using it as a multiplicative operator on your movement.
make an object move up and down?
By 0868626, with 1 reply.
Replied to by lordhershey, almost 13 years ago:
I would do something like this: int counter = -1; //member variable public void act() { counter = (counter +1) % 10; if(counter < 5) { setY(getY() + 5); } else { setY(getY() - 5); } } Something like that. the counter will go from 0 to 9 forever, if the counter is go up and when it is it goes back down. You can make it start at a random part in the wave by doing this: int counter = Greenfoot.getRandomNumber(10); the +5 and -5 are just numbers I pulled out of thin air; it can be whatever you need it to be.
736
737
738
739
740
741
742
X