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
Continuously moving upon mouse click
By Vishnu19, with 2 replies.
Last reply by danpost, over 6 years ago:
The thing that will change is the speed of the actor (-1 or 0). So, it would make sense to use a variable for the speed and just change its value when clicked. The
move
command should not be inside the "if mouse clicks this" block of code.
Re-sizing Image
By DaRafster, with 3 replies.
Last reply by danpost, over 6 years ago:
I would start with a static int variable that contains a zoom percent value initialized at 100 (percent) and base all image sizes (and world dimensions) on it. You can then reduce its value and create a new world to resize everything. Just make sure you do not let the field value get too low (10 might be a fair minimum value). When sizing, multiply by zoom factor, then divide by 100 (<< originial size >> * zoomPercent/100).
Actor's Weapon Problem
By Rafiqi_Fariz, with 4 replies.
Last reply by Rafiqi_Fariz, over 6 years ago:
i already finish this case by myself hhh. i make new method call
fire
and use it when it is touching by the robot. Thank you for your answers
Repaint and GetRandomNumber
By ItzTigerr, with 3 replies.
Last reply by Super_Hippo, over 6 years ago:
Use this in the world’s constructor: <Code Omitted>
World Constructor Threw in an Exception - Help
By DaRafster, with 2 replies.
Last reply by DaRafster, over 6 years ago:
That was it, I didn't notice I missed one value within the xValues array. Many thanks
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...
147
148
149
150
151
152
153
X