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
I do not know why the MyWorld cannot find symbol - class Pinnball here is a copy of what the code under MyWorld is showing.
By DavidButts, with 3 replies.
Last reply by DavidButts, almost 9 years ago:
Thank you, I just now caught the misspelling after I posted the code.
i can't get my background music to stop playing after i pause the game
By darkenders, with 26 replies.
Last reply by danpost, almost 9 years ago:
There is no 'stopLoop' method listed in the GreenfootSound API documentation I gave a link to above. Try again. Make use of the documentation. You do not have to memorize it. Just give it a once over to see what is available in the class.
Breakout: detect side collision between a ball and bricks
By Rubendg, with 1 reply.
Replied to by danpost, almost 9 years ago:
The simplest way to determine where the hit occurs on the brick is to separate the horizontal and vertical movements of the ball (do them individually, checking for collision after each). You will need another method like the one given above to deal with horizontal movement collisions. If you really want accurate brick-ball collision bouncing, check out the code to my
Pong Pinball
scenario.
Space Invaders
By Daave, with 3 replies.
Last reply by danpost, almost 9 years ago:
I have an uploaded scenario called
Space Invaders Movement Demo
from which a review of its code might help you. EDIT: I just looked at it again myself. It might not be the best coding for determining if an invader has another below it. I probably decided not to use the 'getObjectsAtOffset' method because one could be found quite a margin below it (with invaders killed off from rows in between) and the way I did it only required one check.
Needing help at making a artificial intelligence
By MrXeth, with 1 reply.
Replied to by danpost, almost 9 years ago:
MrXeth wrote...
I need help at returning the closest object of one class for this and going to the y coordinate of this object. I will be very happy if you can help me.
What have you tried? or (if not anything), how do you think this can be appoached (what individual steps, specifically, do you think can be used to accomplish this)?
Null pointer exception error
By bryanz1345, with 2 replies.
Last reply by bryanz1345, almost 9 years ago:
Hey danpost! thank you for the quick reply , moving lines 49 - 54 was a super simple solution thank you for your help it was greatly appreciated!
I need to make my game end after 60 seconds.
By SPCWW, with 4 replies.
Last reply by SPCWW, almost 9 years ago:
Actually ive found a way.
Trouble Idling.
By Beamo, with 2 replies.
Last reply by Beamo, almost 9 years ago:
Oh! Thanks for the hint I got it now! In regards to creating fields for the idle images, that's a great idea thanks! Thanks for replying danpost!
I cant get enemy to shoot back at oponents
By pzb0024, with 1 reply.
Replied to by danpost, almost 9 years ago:
Your Enemy actors are not turning -- that is, their rotation is always zero. So, passing 'getRotation()' for the direction of a new Bullet object does not make any sense. There are a couple other anomalies in your code. Line 10 appears to do nothing. Line 55 adjusts the direction of a bullet one degree left for no apparent reason. All your speeds (for both the enemies and the bullets) are negative values which is counter-intuitive. As far as the direction of the bullets, you need to use 'turnToward' with the coordinates of the opponent (or calculate, using trig functions, the angle of
Animate while move
By MrKryptus, with 4 replies.
Last reply by Yehuda, almost 9 years ago:
@MrKryptus See the following. "Posting code?
read this!
"
Add object
By Confringo, with 1 reply.
Replied to by danpost, almost 9 years ago:
Remove the line that is causing the error: <Code Omitted>You cannot execute that method until the Spaceship1 object is created and added into a world. Where you have the line, it is executed while the object is being created and before it is added into a world. Change all remaining 'world' in your code to 'getWorld()'. The only thing that should be new in the class are lazer objects. When the 'act' method is executed, which executes the 'shoot' and 'checkKeyPress' (missing from given code) methods, a Spaceship1 object exists and is in a world. You do not want
Corrupted Code of Sorts
By Agent40, with no replies.
I have never experienced this before but my code has turned into something I've never seen before unless opening a .jar or .dll in notepad. This area was the base parent class for my characters and now it has turned into this. <Image Omitted> So my question is, is that Has anyone else ever seen this happen in greenfoot and if so does anyone know a fix for this to revert the code back to it's original state. Greenfoot is running off of a external hard drive as well and I don't know if that could a contributing factor. Thanks in Advanced,
SetVolume() creates NullPointException
By LuizAntonio, with 4 replies.
Last reply by LuizAntonio, almost 9 years ago:
danpost wrote...
You could try . If your enemy death sound is from a "wav" type file, then the only thing I could imagine is that the one sound file is not properly formatted or corrupted. Otherwise, you might try reformatting it to the same type as the enemy death sound file.
You were right. I downloaded a WAV to MP3 converter and used the new MP3 file and it worked successfully. Sorry to waste your time, I should have guessed this was the problem all along. Thank you.
Instance variable
By Vishnusadagopan, with 1 reply.
Replied to by danpost, almost 9 years ago:
An instance variable is (a non-static) one that is declared outside of any method (as opposed to being declared within a method).
Objekte übereinander, welches oben
By Jonas0602, with 1 reply.
Replied to by danpost, almost 9 years ago:
Use 'setPaintOrder' method of World class (possibly -- if understood correctly).
319
320
321
322
323
324
325
X