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
Moving HP bar
By andrewchin, with 3 replies.
Last reply by danpost, over 6 years ago:
I am not sure why you do not get an error on line 55. I would think it needs to be: <Code Omitted>Out of curiosity, are your
hpbar
images animated? Just wondering because of the
gif
suffix. Please provide
hpbar
class codes.
One object (car) is hitting another Object(house). House will move after hitting. Car will vanish.
By spaceskull, with 4 replies.
Last reply by spaceskull, over 6 years ago:
thank you so much
Number of objects in a list
By Bikey16, with 2 replies.
Last reply by Bikey16, over 6 years ago:
Oh thanks, I'm so blind.
How to achieve Line Of Sight
By SickTrickz832, with 24 replies.
Last reply by SickTrickz832, over 6 years ago:
danpost wrote...
SickTrickz832 wrote...
Ok, I changed the background image size to 800 x 800 and changed the world size to 800 x 800. The player now 'spawns' in the center of the world. However it doesnt stick to the center and the world doesnt scroll, the player just walks off screen
No -- do not do that. Just replace lines 15 and 16 with: <Code Omitted>
Gave it a go, works perfectly. Only think i gotta do now is make it so the actor doesn’t walk offscreen, and all other actors, like obstacles and pickups, move as well. Thanks for your hel
My code doesn't move to the actual minigame from the title screen
By sjyang24, with 1 reply.
Replied to by danpost, over 6 years ago:
I am surprised that it compiles at all, as you do not seem to be importing
greenfoot.*
at all.
Replace Greenfoot.delay() with a clock/timer to prevent freezes
By SushiLlama, with 22 replies.
Last reply by SushiLlama, over 6 years ago:
Wow thank you! And there wont be any delay? The opponent and I can move even while we are dropping bombs? Thats awesome! Ill try to improve my game further. For now i got no more questions. Ill come back if that changes. But for now i really want to thank you for your kind help! I really apreciate it! <3
Choosing Characters
By CodingCowgirl, with 8 replies.
Last reply by CodingCowgirl, over 6 years ago:
Ok.
loops
By Yichui, with 1 reply.
Replied to by danpost, over 6 years ago:
Yichui wrote...
for-loop scenarios (e.g. changing speed/image of an enemy once a certain score is achieved)
I do not see how your examples could have anything to do with looping. You would not continuously change an enemy's speed or its image multiple times between consecutive frames in the running of the scenario. Loops are used to execute code multiple times during the same act step (at one moment in time as far as a human is concerned). Only the end result will be apparent to the user. One of the first uses you might have for a
for
loop is to add multiple objects into
HealthGUI stops program immediately after world is constructed
By SushiLlama, with 3 replies.
Last reply by danpost, over 6 years ago:
SushiLlama wrote...
Thats everything? Does the default case need it too? Thank you!!!
As long as the
default
case is listed last -- no. There is no more code in the
switch
after the last case, so it is not required for the last one listed.
Random objects
By vande, with 1 reply.
Replied to by SushiLlama, over 6 years ago:
Hey, first of all you could give us more concrete Information, but ill try my best to help. Well Greenfoot.getRandomNumber(10) gives you a 0,1,2,3,4,5,6,7,8,9. So you would want to add 1 in order to start from 1 and end at 9 -> when you dont want to start from 0, you have to add the offset (difference of the higher number mius the smaller one). In your case that would be 10 because the highest number 25 is 10 away from your small number 15. So your code should look like this: public int getRandomNumber(int startNumber,int endNumber) { int offsetRandom = Greenfoot.getRandomNumber(en
Prevent image automatically turning when turning
By SushiLlama, with 22 replies.
Last reply by SushiLlama, over 6 years ago:
Thank you so much!!! Just a week and i already fell in love with this kind community! Solved
How can I draw something?
By ihjufaeshiju, with 1 reply.
Replied to by danpost, over 6 years ago:
You would need to add the
Screen
actor into the world for it to be visible. Also, when drawing the polygon, the last value needs to match the number of elements in the arrays (4, not 3).
errors when compiling system.out.print
By jbiser361, with 2 replies.
Last reply by jbiser361, almost 7 years ago:
ooo thank you so much!
Build a Color object called yell to represent yellow using three integer values.
By jbiser361, with 1 reply.
Replied to by danpost, almost 7 years ago:
jbiser361 wrote...
im just a little confused about the wording because i don't believe you can create a color object.... can someone give me an example of this lol
The
greenfoot.Color
class had two
public
constructors (one even uses exactly three
int
values). It definitely is possible to create a Color object.
Trying to make a tank that faces whichever way its moving
By CharizardXRules, with 1 reply.
Replied to by danpost, almost 7 years ago:
If I understand correctly, you want the following for line 23: <Code Omitted>If not that, then maybe this (my original thought):: <Code Omitted>It really depends on the initial direction the
BarrelLeft
object is pointing (as well as the
BarrelRight
object).
167
168
169
170
171
172
173
X