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
Throws an exception if not logged in
By AbdulrazaqAS, with 7 replies.
Last reply by AbdulrazaqAS, almost 3 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 3 years ago:
Ok, thank you all.
Flocking
By alex_rimbu, with 1 reply.
Replied to by Super_Hippo, almost 3 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, about 3 years ago:
Oh, right. I forgot about that. Thanks
remove Object
By luGGas, with 3 replies.
Last reply by luGGas, about 3 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, about 3 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, about 3 years ago:
You don’t even need to remove the ball, instead put it back to the default position and reset the velocity.
Import Font from .ttf file
By crissty21, with 3 replies.
Last reply by danpost, about 3 years ago:
crissty21 wrote...
RcCookie wrote...
What error do you get?
I don't get an error. I just wanted to share it, so others won't spend a life time trying to figure it out. (as I did)
Just note that this will only work locally. It will not work when uploaded to the site as you cannot use the
java.awt
package here (the legacy version, which require a plug-in, may still work, however).
source code
By CYBERMAN99999, with 1 reply.
Replied to by Spock47, about 3 years ago:
It works fine for me. So you have to provide more information: What are you doing/where are you clicking? What is the reaction your computer displays/provides?
Scenario won't work on website but does in the app
By aleifericsson, with 9 replies.
Last reply by aleifericsson, about 3 years ago:
I have now changed every String.format() into String.valueOf() and now it works! Thank you so much for the help, guys!
I want to pass the score from my MyWorld world to my GameOver world
By KCee, with 3 replies.
Last reply by Spock47, about 3 years ago:
KCee wrote...
I added the code you wrote but it still doesn't pass on the score to the GameOver world
Well, it does, but you have to also use it, e.g. adding in the constructor: <Code Omitted>
How to add a collision to an object?
By shindayoni, with 7 replies.
Last reply by Spock47, about 3 years ago:
Like said: The solution is that the knight has to start in a free position and not already in the trees. However, here is a version that will work even if the player was stuck before the movement. Note that it is not a very efficient implementation and if there is not enough space for the player in the direction in which the player tries to unstuck, it will just stay at the edge of the world. Example: If the given image actually shows the bottom of the world, then there is not enough space for the Knight below the trees, therefore he cannot be unstuck. You need to make more space for her/h
Can't upload game with Gif image
By syahwa_anugrah_ainu, with 1 reply.
Replied to by danpost, about 3 years ago:
syahwa_anugrah_ainu wrote...
why when i upload a game, with added Gif image, it always ends up broken and can't be played?<Image Omitted>
It may or may not deal with Gif images. Some reasons a scenario will not play on the site are: * any use of the
java.awt
library; * any use of the
javax.swing
library; * any thread operations; Also, sometimes calling constructors or
static
methods on
static
variables can be a problem.
act and main method
By Roshan123, with 7 replies.
Last reply by Roshan123, about 3 years ago:
@Spock47, thanks for the answer. Will go into the details after some time..... @danpost, No. Not actually. I am trying to make a clone of greenfoot “act” method in BlueJ and I guess BlueJ doesn't have any feature/method like Greenfoot's act method
i want to increase the speed of an actor every time it spawns
By KCee, with 1 reply.
Replied to by Spock47, about 3 years ago:
You could keep track of the bubble speed in the world when spawning a new bubble: <Code Omitted> But there is a problem in your source code: The attribute speed in class Bubbles is actually not a speed, it is the opposite of speed. If you increase the value of Bubbles::speed, the bubble will move less often; so it results in a smaller actual spee
35
36
37
38
39
40
41
X