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
how to make an infinite world / endless runner
By PetrusderEchte, with 1 reply.
Replied to by RcCookie, over 4 years ago:
Basically the idea behind a moving background is to to have an actor with the background image that moves constantly to one side and if it reaches the edge it moves back to the other side. You can refer to this code I once wrote and tested for this
discussion
.
Remove Class from Actor, when isTouching an Object
By Gallier, with 1 reply.
Replied to by RcCookie, over 4 years ago:
You need to specify an instance to remove, not the whole class. You have two options: Replace the statement inside the if block with <Code Omitted>This method does exactly what the if statement with the code above does.
Delay/Wait/Sleep Command - I want 5 sec pause between 2 commands
By Gallier, with 2 replies.
Last reply by Gallier, over 4 years ago:
Yeah it works. Thanks
UserInfo not working
By Ned, with 3 replies.
Last reply by Ned, over 4 years ago:
Thanks!
When Dragging Actor and moving Actor Around A lot of LAG
By joshthebossxxl, with 2 replies.
Last reply by RcCookie, over 4 years ago:
I does not matter weather there are other objects in the world, and it also applies for big transparent images.
How do you find out if your actor is in the top-half and bottom-half?
By BlueHand, with 8 replies.
Last reply by danpost, over 4 years ago:
BlueHand wrote...
I'm trying to make it so that an object (participant) turns 90 degrees every time it encounters an obstacle. The direction of the turn should be different depending if they are in the top-half or bottom-half of the world. Top-half turn clockwise, bottom-half turn counterclockwise.
Okay, so the code you have shown is inside another
if
block, like "
if (isTouching(Obstacle.class))
". Then your code should be okay. It could be more succinct, like this: <Code Omitted>or <Code Omitted>
How do you change a value in a actor at a certain location
By KylesGallery, with 1 reply.
Replied to by danpost, over 4 years ago:
KylesGallery wrote...
I want to change a boolean but the objects are never touching and there will be multiple of both actors, so i want to get code so it only changes it a actor if it is at a certain location
Show attempted codes (need to know what you are dealing with).
x value
By BlueHand, with 1 reply.
Replied to by danpost, over 4 years ago:
First, you need to declare the variable "
x
". Next, with code being in your world class, if anything "
world
" should be "
this
". Finally, "
grass
" needs to refer to a
Grass
object. However, you seem to already know its width. <Code Omitted>
how to teleport to a location as a character movement?
By ambrokato, with 1 reply.
Replied to by danpost, over 4 years ago:
Essential code: <Code Omitted>A direction key must also be pressed. The dashing can be limited either by distance traveled or by time between use, or both.
Help needed!:
By amit3118, with 2 replies.
Last reply by danpost, over 4 years ago:
Change line 11 to: <Code Omitted> and line 12 to: <Code Omitted>
Help needed!:
By amit3118, with 3 replies.
Last reply by RcCookie, over 4 years ago:
To set the image of an actor: <Code Omitted>
How to create a “border”
By BlueHand, with 1 reply.
Replied to by RcCookie, over 4 years ago:
A for loop follows this system: <Code Omitted>Here’s a normal for loop printing the numbers 0-9. Usually the counting variable is called i (short for index, iterator,…): <Code Omitted>In your case, you may want to use a slightly different loop:
Stuck near the teleport instead of transportation to a new location
By Olexandra, with 2 replies.
Last reply by Olexandra, over 4 years ago:
Thanks! I thought that stepping away should prevent the cycle. But it doesn't work. <Code Omitted>
java.lang.NullPointerException error
By BenjiFoxy, with 9 replies.
Last reply by danpost, over 4 years ago:
An easier way is to not worry about which counter it is. You only need one Counter class that can create both counters. Your Tardis class would simply be:
I can't seem to fix the error I get for paddle 2, which is cannot find symbol. I understand how I got the error but do you guys know how to fix it?
By Dannythechanp, with 8 replies.
Last reply by danpost, over 4 years ago:
I do not understand why a paddle would need to know anything but what keys to react to:
73
74
75
76
77
78
79
X