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
Very hard for a beginner!!
By Jpinkham, with 1 reply.
Replied to by danpost, almost 4 years ago:
Jpinkham wrote...
The game was working fine but when i tried to put timer then the game started to crash down. I removed the timer but still it shows error but doesn't show where the error is. I tried restarting it, now it wont even open and wont show Mainworld() sub class. Can anyone please help me with this?
You will either have to upload your scenario to this site with publish source code checkbox checked or show all your class codes here (using 'code' tags).
How can I put a delay between bullets?
By DavidZyy, with 1 reply.
Replied to by Spock47, almost 4 years ago:
First thing is to decide how long the delay between two bullets should be, e.g. "2 seconds". Since Greenfoot regularly calls the act method, the unit for the delay should be "number of calls to the act method" (/"cycles"). On normal speed, Greenfoot calls the act method approximately 60 times a second. 1. So, let's define a constant for the duration until the next bullet can be fired: <Code Omitted> 2. Next, an attribute is needed that stores the current state of the cooldown, e.g. storing the remaining time (in cycle
Is it possible that a scenario stops and restarts itself?
By lehrerfreund, with 6 replies.
Last reply by rdFx, almost 4 years ago:
I'm not sure but this might help you. You can always define methods in the World class that are callable via right click on the scenario screen. So in your case you might want to add a method "showTutorialText()" or "switchSound()" that is defined in your World class (needs to be public i guess) and is callable via right click (a drop down with all methods should be shown). This only works if you don't need to run your scenario as an app but it will work if the scenario is paused in greenfoot!
Stop all GreenfootSounds at once?
By lehrerfreund, with 7 replies.
Last reply by Spock47, almost 4 years ago:
lehrerfreund wrote...
There is one flaw: If a not registered sound is called (...) a FileNotFoundException is thrown by the create-method.
Good catch! :)
Check for mouse click without act()-method running
By lehrerfreund, with 8 replies.
Last reply by RcCookie, almost 4 years ago:
The other problem is that, because Greenfoot does not restart the JVM every time you press "Reset", threads will remain running until you restart Greenfoot. To fix this, we have to keep track of the actors that were created and stop threads of actors that are not on the active world. Putting it all together:
showing error in semicolon of stsement
By sashvanth, with 2 replies.
Last reply by sashvanth, almost 4 years ago:
ok
Check an offset relative to my rotation
By AbdulrazaqAS, with 2 replies.
Last reply by AbdulrazaqAS, almost 4 years ago:
danpost wrote...
AbdulrazaqAS wrote...
Hello, I want to always check what is in front of my actor before moving but i dont know how i will use the method getOneObjectAtOffset(int dx, int dy, Class<?> cls) or any other method to achieve that.
Use sine and cosine of rotation multipled by distance. Rotation will need to be converted to radians.
Thanks, it worked.
Error reading file when game is exported
By drhorriblejr, with 3 replies.
Last reply by danpost, almost 4 years ago:
drhorriblejr wrote...
That's just the name of the file without the extension. I currently only have one level named test so it makes the path "levels/test.txt," and that path exists in the greenfoot project directory locally
Seems like you have everything in order. Maybe your file operations are not what javascript would allow.
Throws an exception if not logged in
By AbdulrazaqAS, with 7 replies.
Last reply by AbdulrazaqAS, almost 4 years ago:
danpost wrote...
AbdulrazaqAS wrote...
I have uploaded the scenario, all the following classes are using UserInfo class; Area, FirstScreen, Board and Bomb.
Unfortunately, the
UserInfo
object may still be
null
even when storage is available. Therefore, after assigning the object to a variable using
getMyInfo
, check it for
null
before trying to work with the object (in each and every place you access it).
Thanks it works.
Not displaying User Image
By AbdulrazaqAS, with 5 replies.
Last reply by AbdulrazaqAS, almost 4 years ago:
Ok, thank you all.
Flocking
By alex_rimbu, with 1 reply.
Replied to by Super_Hippo, almost 4 years ago:
You can check out this one for a start:
https://www.greenfoot.org/scenarios/13501
change Image
By luGGas, with 2 replies.
Last reply by luGGas, almost 4 years ago:
Oh, right. I forgot about that. Thanks
remove Object
By luGGas, with 3 replies.
Last reply by luGGas, almost 4 years ago:
Passt schon habe es mit <Code Omitted>gelößt.
Move/Rotate multiple objects as one
By hfgd, with 3 replies.
Last reply by danpost, almost 4 years ago:
hfgd wrote...
Yes, I have "block" that summons the tiles when created, falls down and can be controlled. But iI don't know how to rotate the tiles together with it
Show codes of "block" class.
BrickBreaker Game
By amberlin24, with 1 reply.
Replied to by RcCookie, almost 4 years ago:
You don’t even need to remove the ball, instead put it back to the default position and reset the velocity.
36
37
38
39
40
41
42
X