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
Asteroids scenario
By Mack, with 3 replies.
Last reply by danpost, about 11 years ago:
Mack wrote...
I'm getting lost with the second part Danpost, can you please show me that code?
The following code only gets the current state of the key: <Code Omitted>If this value (of 'upKeyDown') is saved in a field and later compared to a later state of the key, we can get when the state of the key is changing:
MouseInfo Question
By Programmer1998, with 1 reply.
Replied to by danpost, about 11 years ago:
One major issue is that you are creating
new
Red and White objects on lines 13 and 14. These objects are
not
any of the Red or White objects you may already have in the world and themselves are not in your world. Therefore, the conditions on lines 23 and 45 where you check for mouse presses on these objects will always be false. Better would be to check for
any
mouse press with: <Code Omitted>and then, if it becomes 'true', get the Actor object, if any, the mouse was pressed on:
Greenfoot and Github
By DogeOverlord, with 1 reply.
Replied to by DogeOverlord, about 11 years ago:
It does. I didn't know enough about Github before posting this.
Reading an image
By Vellyxenya, with 5 replies.
Last reply by Vellyxenya, about 11 years ago:
Thank you very much, it finally works! :)
Help With getWorld()
By Elexios, with 2 replies.
Last reply by davmac, about 11 years ago:
You want 'instanceof' as danpost says. Just be aware that it returns true if the world is an instance of the named class or any subclass. So if Level2 was a subclass of Level, then 'getWorld() instanceof Level' would return true if the world was either a Level or Level2 instance. From your description it doesn't sound like that's the case, so I think using instanceof is fine. If you did need to confine the check to a single class, use: <Code Omitted>
"Bound must be positive"
By Vellyxenya, with 3 replies.
Last reply by Vellyxenya, about 11 years ago:
Oh yes I see, thank you very much!
world transition
By hoothoot, with 2 replies.
Last reply by danpost, about 11 years ago:
hoothoot wrote...
i used a simple timer to help but it didn't work for some reason
I do not think the timer is the issue here. Your check for the first level sets the value of 'level' to '2' and the check for the second level will find 'level' at '2' immediately after. Simple solution: change the 'if' on line 21 above to 'else if'.
dodgeball game
By devoncnp, with 1 reply.
Replied to by ElNo, about 11 years ago:
Hi, I used your code and added the two Methods checkCollision() and throwBall(). You will need a new Subclass of Actor (Ball) for it to work.
Game keeps pausing
By Collin, with 26 replies.
Last reply by danpost, about 11 years ago:
@NORTON, your project must be able to compile without error for your world to show. The error, "reached end of file while parsing", means that you are missing one or more closing squiggly brackets. Make sure all your brackets are paired appropriately. (btw, the missing one may not be at the end of the file itself, but within the file somewhere). Note (for the future): please do not use all uppercase letters in your discussions. It makes it seem like you are screaming and most people will not respond to you. Also, when you get an error, as you have here, you should supply the class cod
HElP.
By makconas, with 9 replies.
Last reply by danpost, about 11 years ago:
It does not good to pass the color and rank values to the Chess constructor unless you do something with them in that constructor. Add two instance int fields to the Chess class to hold those values and set those fields in the constructor.
PROGRAMMING
By NORTON, with no replies.
HEY I JUST NEED HELP TO START MY PROGRAMMING CAREER ANY VOLUNTEER. I HAVE TRIED THIS DR. WHO BUT IT AIN'T WORKING TO ME
Problems removing an Object
By sidetracked, with 2 replies.
Last reply by danpost, about 11 years ago:
@Collin, the change you suggested may remove the error; but the object created at line 4 is never added into the world, so you cannot remove it from the world. That, and there appears to be more basic issues involved. @sidetracked, maybe my
Value Display Tutorial
might be of some help.
How to make some specific character move zig zag
By ajikresna, with 1 reply.
Replied to by danpost, about 11 years ago:
I believe you are wanting that your actor move to a random point in the world; and then to another, and then to another, etc. One way is to have int fields to hold the following: (1) the x-coordinate of the starting point, 'x0' (2) the y-coordinate of the starting point, 'y0' (3) the x-coordinate of the destination point, 'x1' (4) the y-coordinate of the destination point, 'y1' (5) the total number of steps required to move from the destination point, 'reqSteps' (6) the number of steps processed from the starting point, 'steps' (7) the speed of the actor (pixels per move), 'speed'
How to check if the player is touching a certain image?
By kdworczyk, with 2 replies.
Last reply by kdworczyk, about 11 years ago:
yeah I realized that now and changed it which turned out to be surprisingly easy. Cheers for the asnwer
Jump Code for platformer
By EggsD, with 1 reply.
Replied to by davmac, about 11 years ago:
Nobody can help you when you don't post your code! Post your code.
536
537
538
539
540
541
542
X