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
Change Background while Mouse ist over a specific area
By xandreas_1, with 1 reply.
Replied to by danpost, over 6 years ago:
Use a boolean field to indicate mouse being over that area or not (or indicating background state): <Code Omitted>
Highscore counter
By minetruck, with 10 replies.
Last reply by minetruck, over 6 years ago:
danpost wrote...
Not that it will fix your problem, but why do you stop the music and then call that method to "stop" the music?
idk i think i forgot to remove it ... but thank you. i think i ll leave it without high score, it is not so important, but still thank you very much
Mülltrennung/Wasteseparation
By Cool, with 1 reply.
Replied to by Super_Hippo, over 6 years ago:
The code for adding 1 about every second seems alright. There are close to 60 act cycles a second when the speed is set to 50 = the middle (and there is no lag of course). Depending on what is happening instead of what it should, it might be clever to not have the counter and the timerStopped variable static or initialize them when creating a new Mülltrennung world.
What is wrong with my code?
By DaRafster, with 3 replies.
Last reply by DaRafster, over 6 years ago:
Thank you, still, a beginner in coding will definitely double-check the brackets from now on!
game gives to much points
By Milad, with 4 replies.
Last reply by danpost, over 6 years ago:
Line1
and
Line2
are not players and should not extend the
Player
class.
Player1Wins
and
Player2Wins
are not
Player1
and
Player2
type objects and should not extend those classes. Create a generic
Line
class extending
Actor
and have both
Line1
and
Line2
extend it and create a generic
Win
class extending
Actor
and have both
Player1Wins
and
Player2Wins
extend it. If you want to associate a particular player with the different lines and win objects, then put each of those specific classes in
Isn't loading new background
By kowordidi, with 1 reply.
Replied to by Super_Hippo, over 6 years ago:
Move line 7 to before line 4 (or at least before line 6). So set the background before you remove the actors. The actor which is executing the code (the ship) is removed from the world in line 6. After that, you can’t try to set the background of the world which is returned by getWorld() because that is null (the object isn’t in any world since you just removed it from the world). Alternatively, you can get the reference to the world before removing it:
Trying to make an actor that spawns randomly in my world
By Adrian2004, with 6 replies.
Last reply by Super_Hippo, over 6 years ago:
Adrian2004 wrote...
What do you mean? It's in the world. Sorry I'm a beginner.
Oh wow, I was quickly going over the code and saw all that moving and turning that I instantly thought it had to be an Actor subclass..
Remove object if it hits the line
By Milad, with 9 replies.
Last reply by Milad, over 6 years ago:
thank you it worked
Tic Tac Toe
By ItzTigerr, with 2 replies.
Last reply by lehrerfreund, over 6 years ago:
If you mean your world should be just a 3x3 grid you could just adjust this in the World-class: <Code Omitted> This means that your world is consisting of 3x3 cells, every cell is 200x200 pixels (so the width of your world actually is 600px - 3 cells a 200 px).. You can set your marks with something like <Code Omitted> This sets a mark into the middle cell, as you start counting cells with 0: 0/0 1/0 2/0 1/0 1/1 1
need help
By Starlord_20, with no replies.
<Code Omitted> in my little game, I want the player play against the computer. After every round the total is added together, but if your random number is 1, the currend round isn`t counted. The Game lasts until the required count of rounds (int a) is reached. my problem: the output of the total (int summe1 and int summe2) doesn`t work...
check for value
By Starlord_20, with 1 reply.
Replied to by danpost, over 6 years ago:
Use a
boolean
flag. Initialize it before, test while inside (changing its value if
random
is 1) and check its value after the
while
loop to do whatever when 1 hits.
Ping Pong Game
By _kr_696, with 7 replies.
Last reply by _kr_696, over 6 years ago:
now I need to make a score counter I have this so far. I don't know what else to do.
Ping Pong Game
By _kr_696, with 2 replies.
Last reply by danpost, over 6 years ago:
_kr_696 wrote...
Need help making boundaries in pong. I'm really new to coding.
A simple breakdown of pong ball boundary codes would be like: <Code Omitted>
NullPointerException
By Balu, with 2 replies.
Last reply by Balu, over 6 years ago:
I solved the problem! I changed something in the counter class and it dident work anymore, so i copy and pasted everything in to a new scenario and it worked! But thank you for your response!
End Game
By vikki, with 1 reply.
Replied to by danpost, over 6 years ago:
vikki wrote...
i want my game to end after all crabs have been eaten, but i dont know what the code is, and where to place it. please help!
Add an
act
method to your
World
subclass (
MyWorld
) and go to end when no crabs are in world.
147
148
149
150
151
152
153
X