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
Stop walking ffs
By MrPancakes, with 7 replies.
Last reply by MrPancakes, over 10 years ago:
oh nevermind. i figured it out. Thanks for the code ;)
for loop
By smcgee, with 11 replies.
Last reply by smcgee, over 10 years ago:
Thank you for that explanation - very helpful.
Problem with declaring a string variable
By bernhard, with 2 replies.
Last reply by bernhard, over 10 years ago:
oh thanks
Get amount of one object
By Julian109998, with 1 reply.
Replied to by danpost, over 10 years ago:
The World class API documentation shows that the 'getObjects' method returns a 'java.util.List' object -- not an 'int' value. Go to the API documentation of the List class,
here
, and find a method that returns the required 'int' value.
Greenfoot.stop()
By Miro29, with 7 replies.
Last reply by Miro29, over 10 years ago:
danpost wrote...
Miro29 wrote...
After you showed me where the problem was, i was happy, because I got rid of the problme, but then I asked my self the why question :) Teh conclusion I got to is that the semicolon in my case transformed the if into an instruction and based on that logic, it just executed whatever came next. Can you please tell my if I understood correctly what happened ?
It is not that the 'if' is transformed into an instruction. The semi-colon is an empty command by itself. So, the non-bracketed empty command is executed when the 'if' clause is true and either way t
Game over through multiple levels and when Actor/Objects are colliding
By kinghunter, with 4 replies.
Last reply by danpost, over 10 years ago:
valdes wrote...
if you remove the object, the object is no longer in the world, making a few methods fail, for example getOneIntersectingObject() and isAtEdge(). To correct that, change the if's to if-else or add inside each if <Code Omitted>
An alternative to this is to combine the three if statements, since the code within each block is the same:
Helicopter game need help with switching worlds!
By joseph.a, with 3 replies.
Last reply by valdes, over 10 years ago:
If you are just changing the image of the background you don't need class DayTime at all. in your HelicopterWorld add the following: <Code Omitted>
Helicopter game need help displaying score under gameover
By joseph.a, with 1 reply.
Replied to by valdes, over 10 years ago:
Your two worlds are independent, so you cannot cast one into the other. I imagine that showGameOver() is inside some Actor class. That actor will need to know inside what type of World is in, to do the proper cast <Code Omitted> The elegant solution will be to use inheritance. Create a new World: <Code Omitted> change both your worlds inheritance to
Exported Greenfoot Project not Running Properly
By Nintendoge, with 7 replies.
Last reply by Nintendoge, over 10 years ago:
Ok, that makes a lot of sense. Shame I didn't find that discussion earlier! Thanks for helping me out.
Casting int to double
By gmacias, with 4 replies.
Last reply by gmacias, over 10 years ago:
now I understand! Thank you.
Basically trying to get a ball to be hit by a shooter and into a goal. Works once, would like to keep score and replace shooter and ball in world. Have two different versions, commented out lots.
By MNastasi, with 1 reply.
Replied to by danpost, over 10 years ago:
Try, instead of removing and replacing the ball with a new one, to just reset the location of the current ball back to (311, 365) using: <Code Omitted>.
Collision issues
By grizzly1, with 5 replies.
Last reply by danpost, over 10 years ago:
grizzly1 wrote...
could u maybe give me a little code on how to fix that, I just can't figure it out myself
danpost wrote...
I think the problem stems from the order that you are doing things. You are increase the speed after moving. If it is intersecting a block, you set the speed back to zero and no movement will occur.
What I said here suggests that you first increment the speed and then move. Switch lines 127 an 128 above.
Programming Best Practice in Animation: Which is better?
By gmacias, with 2 replies.
Last reply by gmacias, over 10 years ago:
Good to know. Thank you for your help! :)
Right key works, but left doesn't Help!
By MNastasi, with 2 replies.
Last reply by danpost, over 10 years ago:
Super_Hippo wrote...
I personally avoid using the getKey-method and use the isKeyDown-method though.
As you should -- the getKey' method is best suited for string input where typing in words or numbers outside of gameplay is required.
changing what an AI actor does each level
By kinghunter, with 1 reply.
Replied to by danpost, over 10 years ago:
kinghunter wrote...
I'm currently making a game in which a spaceman has to avoid the bullets fired by an alien ship and advances to the next level. I'm stumped how do i change what the alien does, specifically rate of fire and direction in my new levels instead of the same thing each time... any help is greatly appreciated
You could do something like this: <Code Omitted>for example. The problem is that you cannot do this until the actor is adde
454
455
456
457
458
459
460
X