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 am trying to get my Enemy class to explode when hit with a rocket. Would anyone know the best way to do this? Right now all they are doing is disappearing when hit.
By pzb0024, with 2 replies.
Last reply by pzb0024, almost 9 years ago:
Awesome, Thanks!
Way does my score increses whit more than one??
By vbh, with 6 replies.
Last reply by vbh, almost 9 years ago:
ty very much its working :-) i dont think i would have figured that out myself
Random Movement
By Beamo, with 2 replies.
Last reply by Beamo, almost 9 years ago:
Yep, that seems to do it! Regarding the shoot and explode functions, I have yet to describe them as other classes will call them. And the setRandomNumber function was a solution to the problem i had attempted a while back. Thanks for providing me with the solution!
student attendance error
By divinity, with 10 replies.
Last reply by danpost, almost 9 years ago:
For one thing, I do not think you needed to create another class. The error is because you created a class with an open command line (an 'if' statement that is not within a code block). Show what you tried with the arraylist.
Update old code to the latest version of greenfoot
By diablo95, with 1 reply.
Replied to by danpost, almost 9 years ago:
I, for one, am not about to have another file transfer program installed just for your code. I suggest you post the problem code here. Use code tags (refer to the link below the reply box if not clear as to how -- "Posting code? read
this
").
Key Control Sporadic
By bigShovel, with 1 reply.
Replied to by danpost, almost 9 years ago:
The code, as given, appears to be okay. In fact, I ran it with no issues (win 7/gf 3.1.0 usb). The only thing I can think of is that you could have other code in the project which relocates the hero (like an enemy or obstacle). I would doubt it to be your version of greenfoot, unless you and all your students had the same one on your systems. If you are all on the same network using the same program, you may try re-installing it.
It says something is missing?
By ferna8533, with 2 replies.
Last reply by danpost, almost 9 years ago:
I would like to see what the first line in your world construtor looks like (the 'super' line). Actually, better would be to provide the entire constructor. And Hippo is right. The stated line, as is, does nothing.
how to get player to move up the screen
By darkenders, with 1 reply.
Replied to by Super_Hippo, almost 9 years ago:
<Code Omitted>
Error while creating objects of Actor class
By Sowmya02, with 1 reply.
Replied to by danpost, almost 9 years ago:
You have two problems (at least). The one causing the error is this: the 'fly' method cannot be executed on an Object2 actor that is not in any world; yet, you are calling it (see line 63) on 's2', which you had just created (line 60) but has not been added to a world. This brings us to the other problem, which is line 93. I presume the missing method name was to be 'addObject'; however, the Object2 actor created on that line does not have a successor (which I presume you wanted the one added into the world to have). The methods 'getX' and 'getY' cannot be called while the actor is not i
Im getting an error from the world constructor when I try to compile
By darkstargamer, with 6 replies.
Last reply by darkstargamer, almost 9 years ago:
thank you!
Why doesn`t it work? Reference to world
By wueschn, with 6 replies.
Last reply by wueschn, almost 9 years ago:
OK, thanks a lot!!
I am trying to create a Score Counter in my Game
By proshiv, with 1 reply.
Replied to by danpost, almost 9 years ago:
It appears you have placed the 'scoreCount' field in the Asteroid class. As such, each asteroid created will have its own scoreCount integer and none could ever reach the value of 2 (each becomes 1 when the asteroid is destroyed). Obviously, then, you have misplaced where the 'scoreCounter' field can be. If it a game score, put it in your game World subclass; if each object that shoots bullets is to maintain a score of its own, then put it in the class of the objects that shoot the bullets.
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.
318
319
320
321
322
323
324
X