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
java.lang.NullPointerException
By equopan, with 5 replies.
Last reply by danpost, about 2 years ago:
equopan wrote...
I inspected the player and waffe is for some reason null. So there has to be a problem with the code at some point
You show this code:
Need Help With Pacman in clara world
By IcyCake242, with 1 reply.
Replied to by IcyCake242, about 2 years ago:
This is what I have written so far
How to change background while running a loop
By TillaB13, with 9 replies.
Last reply by TillaB13, about 2 years ago:
Thank you for the help, but I figured it out. I needed to break out of the loop and let the lava() method run in the act method. I LOVE YOU DANPOST THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!
Recipe list
By ThieTime, with 1 reply.
Replied to by danpost, over 2 years ago:
ThieTime wrote...
Hello, how can you create a recipe list when you press a specific keyboard key (without changing the world)
You want to create an object, yeah, an
Object
, a
RecipeList
object to put in the current world. Is that correct?
Help make gravity.
By Mr_Potato, with 9 replies.
Last reply by danpost, over 2 years ago:
Mr_Potato wrote...
nope. I keep having the same problem. after a few bounces it just changes a lot.
I think your problem is that you need the change in motion of the ball to be smaller than a single pixel, which impairs on the smoothness of the motion. Solution is to use
float
s or
double
s to track the current location of the actor. Cast the values back to
int
s when setting location.
Collision problem in a platformer game
By Parrot279, with no replies.
Hello, I'm new in programming in greenfoot and I've encountered a problem when coding the collision method. When meeting an obstacle, my actor only phases through the upper part of the obstacle. These are my methods used to detect obstacles, respectively if the actor is on the ground: public void detectObstacole() { int dx = 0; int dy = 0; // checking for collision on the right side while (getOneObjectAtOffset(getImage().getWidth() / 2 + 1 + dx, 0, Platobstacole.class) != null) { dx--; } // checking for collision on the left side while (getOneObjectAtOffset(-getImage().getWidth() / 2 - 1 + dx, 0, Platobstacole.class) != null) { dx++; } // checking for collision on the top side while (getOneObjectAtOffset(0, -getImage().getHeight() / 2 - 1 + dy, Platobstacole.class) != null) { dy++; } // adjusting the position setLocation(getX() + dx, getY() + dy); } public boolean pePamant() { //checking whether the actor is on ground int x = getX(); int y = getY(); // checking for collision at current position if (isTouching(Platforme.class)) { return true; } setLocation(x, y + vitezaVerticala);// checking for collision at next position boolean onGround = false; if (isTouching(Platforme.class)) { onGround = true; } setLocation(x, y); // returns to former position return onGround; } As a note, the "Platforme" (which only includes platforms) class is a subclass of "Platobstacole" (which includes both platforms and obstacles).
How to add a loop background sound that goes in multiple levels and stops when the character dies.
By I3litz, with 2 replies.
Last reply by I3litz, over 2 years ago:
Thank you im gonna try it out.
My lava block is moving over the edge of the platform!
By I3litz, with 4 replies.
Last reply by I3litz, over 2 years ago:
Thank you so much your truely the Greenfoot-Master.
I need help making a bullet of some kind.URGENT!
By da3m0nium, with 3 replies.
Last reply by da3m0nium, over 2 years ago:
Thanks guys so much!!
how to make actors move in order?
By aabcin, with 2 replies.
Last reply by danpost, over 2 years ago:
aabcin wrote...
so i have this 5 lanterns and i want to lit up 3 of them but like in order, like 5-4-2, but when i try to write in code it lit up at the same time
A
for
loop, as
Kyuubi
suggests, will not work here. The loop will complete its processing in one act step and all will light up immediately as a result. It would be difficult to provide decent code without seeing what you have to work with. Please provide your Lantern class code. Then, also, provide any code you have outside that class that controls (whether working or not) the lighting/darkening of the lante
Jar File not running?
By Kyuubi, with 1 reply.
Replied to by Kyuubi, over 2 years ago:
Update,: i emailed greenfoot team and it is indeed a known problem and unsolveable
Platform that one shot my character!!!
By I3litz, with 7 replies.
Last reply by Kyuubi, over 2 years ago:
Ur welcome dwdw :)
RUNNING JAR ERROR
By untillNess, with 1 reply.
Replied to by Kyuubi, over 2 years ago:
same problem, did you find a way to solve it?
Option to export as application not available?
By Kyuubi, with 3 replies.
Last reply by Kyuubi, over 2 years ago:
To give more details, It exports just fine but it doesn't run. Nothing appears, nothing happens upon pressing on it
How to die w/o error
By TillaB13, with no replies.
I am creating a 2d platforming game, where if you hit the lava it sends to a death/lose screen. However, when this happens I cannot reset the world nor terminate the program, and I have to use task manager to close greenfoot and restart my computer before I can open it again. I am using and if to see if its touching the lava, then Greenfoot.setWorld(new dead()). In the method where the characters jumps there is a lot of addition and reseting of variables so I am wondering if thats why its crashing, or if there is something else I should do.
13
14
15
16
17
18
19
X