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
How to make person with the highest score win?
By HairyChickens, with 33 replies.
Last reply by HairyChickens, about 6 years ago:
I don't know if I should create another post on this but is it possible to create a highscore leader board using the scores. So I have a MainMenu world and I created a button that says Highscore and when its pressed it takes you to the HighscoreScreen World. I want the leader board to be in this world. If it is possible do you mind teaching me how to do it. Thanks
making enemies move downwards every couple of seconds (for space invaders game)
By EthanWasHere_, with 2 replies.
Last reply by EthanWasHere_, about 6 years ago:
Thanks! Works like a charm!
Why is ".class" not compiling?
By macaroon72, with 17 replies.
Last reply by Super_Hippo, about 6 years ago:
Well, you call methods on m before you check if it is null. You have to check ‘m != null’ before calling getX() and getY() on it. <Code Omitted>
Shifting Text
By Haylaylo11, with 1 reply.
Replied to by danpost, about 6 years ago:
If using showText, you will not be able to unshift the text. If using an actor, creating the image by way of the
GreenfootImage
constructor with a
String
parameter, the you can vary its position in the world so that the left edge of its image is always at the same place. The other way would be to draw the text image in the above on another image large enough for any input string given by the user; thereby maintaining the same image size and keeping the text left-aligned. I guess a fourth way would be to draw the text image directly onto the background image (so, not usin
Enemies not removing from world
By Ryaj987, with 11 replies.
Last reply by Super_Hippo, about 6 years ago:
Okay sorry, apparently I didn’t read your first post carefully. Didn’t notice that the code was available. I looked at your code and I can tell you what’s wrong with it. You code does remove the enemy. It is not really efficient or easy to read, but it does remove it. The problem is that the world has a list of all skeletons and is constantly updating the location so they correctly move with the background when that moves. The following code (line 142–144 in class “ground”) reads: “if the skeleton isn’t in the world, add it”. And that’s what’s happening. It is removed and then, in the next a
What is wrong with my code?
By macaroon72, with 4 replies.
Last reply by macaroon72, about 6 years ago:
Okay, thank you!
1v1 Soccer Game vs AI
By CardJitsu5, with 4 replies.
Last reply by CardJitsu5, about 6 years ago:
danpost wrote...
I do not think you quite understand. You would add and build the method yourself to give the actor that ability. Sure, you would probably call other methods within the method you create (like, in this case,
isTouching
or
getOneIntersectingObject
) and you can find all the ones provided for an actor in the
Actor class API documentation
.
Yeah I'm not great at this at all haha. Thanks for your help mate
Help with multi-key macro
By 444Jam444, with 34 replies.
Last reply by 444Jam444, about 6 years ago:
It works without throwing an exception in the terminal, but there's still the issue of currentIndex not increasing at all within Calculate class, and a new issue of ... Never mind, I made a couple small changes while typing this message which fixed these issues. All I had to do was change '//world.updateDisplay();' from a comment to code (in button class) and add 'Calculator world = ((Calculator)getWorld());' a couple lines above it. For some reason, hitting an operator throws an exception, but I haven't tried resolving that issue so I'll post another reply if I'm having difficulties wit
Polyspiral
By ronald, with 2 replies.
Last reply by ronald, about 6 years ago:
superb thank you
How to change Actor to SmoothMover
By macaroon72, with 3 replies.
Last reply by macaroon72, about 6 years ago:
Actually, I think I got it! Thanks!
Changing Image from an Actor
By greenfish, with 1 reply.
Replied to by danpost, about 6 years ago:
Changing the state (image, in this case) of one
Player
object does not do the same to all
Player
instances. You need to change the image of the one player already in the world (not create a different
Player
object and change its image; as well, that one was never put in the world, so its image is immaterial). Replace your first two lines with this: <Code Omitted>
Is there a way to hide Greenfoot icon?
By greenfish, with 2 replies.
Last reply by greenfish, about 6 years ago:
thank you! it works.
trouble with superclasses
By genju, with 1 reply.
Replied to by Super_Hippo, about 6 years ago:
Your Soldier class has one constructor. The one with a bunch of parameters. The subclasses should have a constructor which exists in the super class. So you could either create a constructor in the Soldier class without parameters. And/or the subclasses constructors should match. So the constructor of your Heavy class could look like this.
Maze generator not working properly.
By EvanRoscTheDev, with 4 replies.
Last reply by danpost, about 6 years ago:
Apparently,
rand
is alternating between 0 and 1 inside the
do
loop, making
x
add and subtract; add and subtract. You need to be very careful with loops and make sure that they will eventually, at some point, be broken out of. Unfortunately, your coding is (1) undocumented; (2) bulky, and not easily readable; and (3) unfactored; -- making it virtually impossible to see what is going on (especially for an outsider). All I can say at this point is that you need better control of the flow within the loop. A visited cell should not be re-visited.
How to increase my score by increments of 1000
By HairyChickens, with 4 replies.
Last reply by HairyChickens, about 6 years ago:
danpost wrote...
HairyChickens wrote...
Thanks for the quick reply but do you mind showing me exactly what I should type for the addedToWorld method and the multiply 1000. This is my first time playing with coding and I'm not familiar it yet :)
The method would look like this: <Code Omitted>An example of multiplying would be taking "score" in line 29 and replacing it with "(score*1000)".
Thank you so much!!!!
128
129
130
131
132
133
134
X