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
Problems with bullets
By macho_horse, with 2 replies.
Last reply by danpost, almost 9 years ago:
The code is executed for each enemy object. As it executes for each one, the keyword 'this' will refer to the particular enemy object that the code is currently executing for. Therefore: <Code Omitted>or more simply (since 'this' is implicitly implied when no object is explicitly given to call a method on): <Code Omitted>
Timer to switch worlds
By TheAngryWarlord, with 4 replies.
Last reply by danpost, almost 9 years ago:
The code given by 101929ha will not work. The timer can only work by way of an act method (lines 5 through 8 will only execute once -- when the timer is marked, or started): <Code Omitted>This would be for a 30-second timer in a scenario running at normal speeds -- along Hippo's suggestion.
HELP
By ALPH3A, with 1 reply.
Replied to by danpost, almost 9 years ago:
If you used 'Greenfoot.getRandomNumber(4)', you will get a number in the set { 0, 1, 2, 3 }. Adding one to the result will get you a number between 1 and 4. If you are turning by 't*90' degrees and a turn must be executed then you must remember that '4*90 = 360' and no turn will be exacted (the actor will look in the same direction as before)..
Need help stopping music
By BobBanana, with 1 reply.
Replied to by danpost, almost 9 years ago:
Is the first line inside or outside the method? Where is the code given located and what code starts the game and where is it located?
I can't get the terminal window onto my screen!
By Dylex, with 2 replies.
Last reply by Dylex, almost 9 years ago:
That works mate, thanks.
java.lang.OutOfMemoryError: Java heap space
By heyu, with 6 replies.
Last reply by danpost, almost 9 years ago:
Super_Hippo wrote...
The only thing I heard about was Greeps, but I thought that the Greeps (if that are the things moving around and trying to collect something I don't remember) had an act method and the user had to write the act method (which had some limitation of booleans), so the Greeps collect as much as possible on each map before the time runs out.
You are right -- the Greeps scenario does have an act method that is executed repeatedly (needed because each map is run in a specific amount of time or act cycles). I should not have included that in my list. Maybe I should not ha
Create transparent circle
By ironphoenix20, with 8 replies.
Last reply by ironphoenix20, almost 9 years ago:
Thanks. It works now.
NullPointerException
By Nosson1459, with 2 replies.
Last reply by Nosson1459, almost 9 years ago:
Super_Hippo wrote...
I think there is a chance that 'flash' is null and drawing with a 'null' color can't be done. I didn't test this yet and I don't know if it maybe was different in older Greenfoot versions, but it is an idea.
You were right, I didn't notice that 'flash' wasn't set yet. I edited line 28 to: <Code Omitted>
Publish failed
By Nosson1459, with 4 replies.
Last reply by Nosson1459, almost 9 years ago:
davmac wrote...
It should be Ok now. We just transitioned (most) of the server from http to https and there have been a few teething problems - this was one of them.
Thanks, it worked.
removeTouching doesn't work
By vijer, with 9 replies.
Last reply by Nosson1459, almost 9 years ago:
vijer wrote...
But you can't use it to remove theBall when it goes off the edge of the world?
If you want to remove the Ball when it goes off the edge of the screen, then you can put in the Ball class:
Super_Hippo wrote...
<Code Omitted>
Passing a variable from one class of a world to another class in another World.
By py-cod, with 3 replies.
Last reply by Super_Hippo, almost 9 years ago:
You didn't add the constructor to the MyWorld class.
How to avoid nullPointerException
By wueschn, with 4 replies.
Last reply by wueschn, almost 9 years ago:
@Nosson1459 Thanks a lot!!
How To Solve Error:class,Interface And Enum Expected in this Codes
By palash, with 1 reply.
Replied to by Super_Hippo, almost 9 years ago:
You have code outside classes. That doesn't make much sense to make.
How to make a tetris like game
By JupiterForeheadSam, with 1 reply.
Replied to by Super_Hippo, almost 9 years ago:
There are several discussions here about games like Tetris. As a general advise: Four blocks form a tetromino. Always move the blocks together. If one fails to fall, move all four back. For making them disappear: Every time a tetromino fails to move further (which also leads to the creation of the next one), check each row if it is full. If any row is full, remove all the blocks in this row and move every block which is above it (smaller y-coordinate) down once. The scoreboard should be made when the rest works.
My zombies won't spawn!
By Grace20102, with 2 replies.
Last reply by Grace20102, almost 9 years ago:
Nosson1459 wrote...
With your shown code there is no place that an addObject for a zombie gets executed. The only place that there is one is in the spawnZombie method which gets called in the runTimer method which doesn't get called (in the act). Your complete Game class should be:
375
376
377
378
379
380
381
X