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
Head Soccer
By CRISTIANO7, with no replies.
Wie kann man ein Tor beim Fussball programieren?
NullPointerException: problem with ending with gameover
By IshaanMishra, with 2 replies.
Last reply by IshaanMishra, almost 7 years ago:
This was the code when I called GameOver(). Explode removes the spaceship. <Code Omitted>I changed it after what you said to <Code Omitted> and it works now! Thank you so much :)
problems with my bullet
By Simson1000, with 1 reply.
Replied to by danpost, almost 7 years ago:
You have several misconceptions about the way your code is processed. First, all your while loops are infinite loops. Once the condition is true, the loop will repeat forever and nothing else can then be executed. The condition must change within the loop so that it can be exited and the following command can then be processed. If statements would work, however, as greenfoot repeatedly calls the
act
method while your program is running to create the animation loop. All you need to put in the
act
method is what should be done on a single act step. Even better again, is to se
Problems adding actors-scrollworld
By Andrew.2, with 6 replies.
Last reply by Andrew.2, almost 7 years ago:
nevermind i fixed it
help making levels
By 343qwm29, with 1 reply.
Replied to by danpost, almost 7 years ago:
343qwm29 wrote...
I'm making a shooting game with multiple levels and I was wondering how to have the game go to the next level once the enemies in the level are eliminated, can somebody please help?
Add an
act
method to your
World
subclass and check to see if any enemies are in the world.
isTouching is not working.
By denizkb, with 1 reply.
Replied to by danpost, almost 7 years ago:
denizkb wrote...
The code below is in my sprite class, when the sprite touches any enemies it goes to the location however the life counter doesn't decrease. When I remove the code below, the sprite doesn't go to the location and goes through the enemies but it decreases the life counter. << Code Omitted >>
Please show your current entire
checkObstacles
method.
Lives not decreasing when hit an obstacle
By denizkb, with 2 replies.
Last reply by danpost, almost 7 years ago:
Lines 398 through 401 does not help in your
sprite
class. Also, I would think you would want
touchingObstacles
to be
false
at line 413.
My Score Is Not Incrementing When I Pickup A Coin
By denizkb, with 6 replies.
Last reply by denizkb, almost 7 years ago:
danpost wrote...
denizkb wrote...
<< Code Omitted >> This is MyWorld code if that helps. I am still stuck and the score is not incrementing ;/
Change line 132 to: <Code Omitted>and line 150 to <Code Omitted>If problem persist, show sprite class next.
Thank you so much, the score now increments whenever I collect a coin. I would kindly like to ask if you could help me with the lives counter:
https://www.greenfoot.org/topics/61747/0#post_130426
error message can't open scenario
By g.baessler, with 1 reply.
Replied to by danpost, almost 7 years ago:
g.baessler wrote...
The world could not be constructed. The world subclass may not have a public constructor without parameters, or may not be public
Obviously there is something amiss with your World subclass code. Show code for help.
I struggle with giving my actor reversed controls
By Tommes, with 2 replies.
Last reply by Tommes, almost 7 years ago:
Thank you! You helped me a lot!
Compile button not appearing on interface
By TinaFields, with 1 reply.
Replied to by danpost, almost 7 years ago:
TinaFields wrote...
Why does my interface not have a compile button on the bottom right?
Greenfoot now auto-compiles. Any time you change your code, it will compile your project if no errors when detected during the changing of the code when you go back to the main scenario frame,
Control Redirection to Multiple Worlds with One Method.
By Lewis12374, with 1 reply.
Replied to by danpost, almost 7 years ago:
Lewis12374 wrote...
I'm trying to achieve making my menu as abstract as possible, but I cannot seem to find a way around doing so. This is what I have tried so far, with no progression. Please help? << Code Omitted >> The error received is: '(' or '' expected on the SuperClass.
The compiler is expecting a class name followed by a parameter list (a set of round parentheses that may or may not contain any elements). It has yet to complain that you use a String object for the name or that it cannot find a class named "HelpScreen" (including the quotes) -- I suspect it will do one or th
Image
By Adi18, with 5 replies.
Last reply by danpost, almost 7 years ago:
Adi18 wrote...
Thanks. That could be a problem because I want to do something like a character can only jump to the top of the image, but if it touches the left, right or down side is put aside
For that, all you really need to know is the direction that the character moved. For example, if moved right and touches the object, then the object is to the right. Same goes for the other directions. As long as you adjust the position of the character such that it no longer touches the object (moving opposite the initial direction moved), you should not have any issues.
How can you keep variables between worlds
By iminblue, with 21 replies.
Last reply by iminblue, almost 7 years ago:
danpost wrote...
iminblue wrote...
I did it just as you said : addPlayer is in the World's code , and I try to call it from a method inside the Player class : << Code Omitted >> Using this directly in the act() method doesn't work either.
In line 3, you are trying to call
addPlayer
on an object of type
Class
(called
yeet2
). This will not work -- you cannot add a player to a class; you can only add a player to an object of type World (or, in your case, specifically, a
yeet2
world instance). You create one on line 2 and name it
w2
. That is what you
Problem with Object Interaction
By wueschn, with 4 replies.
Last reply by wueschn, almost 7 years ago:
Thanks a lot, what a silly mistake.
213
214
215
216
217
218
219
X