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 respawn an object(s)
By jonah420123, with 3 replies.
Last reply by ErnieBoi, over 6 years ago:
danpost wrote...
jonah420123 wrote...
I have coded the button to disappear on touch but I cant figure out how to make the coins spawn in when the button disappears. I don't know what code to show so if you need any just let me know.
Show any and all codes related to the button. Also include any attempt to spawn the coins when the button disappears or provide what ideas you might have for implementing it.
I am th fan of yours i am ernie you are great greenfoot man yes yes
How to hide actors in the left pane
By AlexDascalu, with no replies.
Hello! I have made a game in Greenfoot that is intended to be used for educational purposes, and I am trying to find a way to hide some of the actors of my game from showing up in the left pane of Greenfoot, so as to make the game less intimidating to a pupil. I could not find anything like that in the API or on the Internet. Does anyone know if there is a way to do that?
yahtzee code
By BlueberryGaming, with 1 reply.
Replied to by danpost, over 6 years ago:
BlueberryGaming wrote...
i am trying to figure out in a case statement/switch statement how to make large straight and small straight we have the die value named as die Value and roll total
Use an array for the individual die values: <Code Omitted>then sort them in ascending order and iterate thru them to find the straights:
Cant find symbol (variable disk)
By jonah420123, with 1 reply.
Replied to by danpost, over 6 years ago:
jonah420123 wrote...
if(disk!=null) <------ says it "cannot find symbol" here as well ... arena.removeObject(disk); <------- says that it cannot find symbol here
Apparently, you have not initialized a variable called
disk
before trying to reference it: <Code Omitted>Once it is initialized, you will need an assignment statement: <Code Omitted>to possibly acquire a reference to a disk object. Then your
if
statement will have a chance to be
true
as well as
false
(provided your assignment may or may not actually a
how to reset a number??
By Toodumbtocode, with 1 reply.
Replied to by danpost, over 6 years ago:
Toodumbtocode wrote...
like how do you reset a score after it gets to a certain number??? thank you
No code, no details -- No help. Always include related codes and specifics. The code should include some attempt at trying to accomplish what you are having difficulty with.
Problem mit dem Kontakt zweier Objekte
By Bolla13, with 1 reply.
Replied to by Bolla13, over 6 years ago:
Hier noch mein Code Versuch: Ich habe eine Variabel deklariert boolean treffer = true; In der Methode public void lookforcrab() { If (canSee (Crab.class) && treffer) { Crab krabbe1 = (Crab) getOneObjectAtOffset (0,0,Crab.class); If (krabbe1 == null) { treffer = false; } If (treffer) { krabbe1.lebenszeit(-1); } If (Crab.anzLeben == 0) { Eat(Crab.class); Greenfoot.playSound(“au.wav”) Greenfoot.stop(); } } }
Greenfoot Changing Levels - HELP!
By Lewis12374, with 2 replies.
Last reply by Lewis12374, over 6 years ago:
Cheers Hippo
Super_Hippo wrote...
You have an object in a world. You set "currentLevel" to 1. When it touches the "Emblem", it's "currentLevel" will be 2. Now a new world is set, a new (=another) object of this class is added to the world (I guess) and its "currentLevel" is set to 1. If your worlds are similar, then use one class for them. Then you can do something like this:
Wall collision - Question
By Monserus, with 1 reply.
Replied to by danpost, over 6 years ago:
Monserus wrote...
I've added collision to an object (a wall), so the actor can't run through it. It works fine, but everytime I want him to turn around and move in a different direction, he jumps through the wall and gets stuck behind it.
In your
move
methods, you should probably set the desired rotation before moving.
Question about an if statement
By Toodumbtocode, with 1 reply.
Replied to by danpost, over 6 years ago:
Toodumbtocode wrote...
How do you make an if statement to detect if your actor has eaten 3 things? I'll give an example in psuedocode << Psuedocode Omitted >> how do i translate that????
First, you need a field to count the number of treats eaten, call it
treatsEaten
, and a method to make the dog dance, call it
dance
. Then, the translation would be: <Code Omitted>
For Loop - Creating Bricks
By Sangate, with 1 reply.
Replied to by danpost, over 6 years ago:
Sangate wrote...
Hello, I'm trying to create rows like the ones in the Picture << Image Omitted >> With the code below i'm able to create Level 1 (The 1st picture 9x9 Bricks).. But i'm really struggling with the other ones. Could someone help me out? << Code Omitted >>
For the first one, the only things that may be missing are color control, proper horizontal centering and the use of the parameter,
pRows
, within the method. Moving on to Level 2 arrangement, without concern for colors, you just need to restrict the adding of bricks when some condition is
true
. With pr
dodo asaignment 5.5
By plszhelpmeh, with 1 reply.
Replied to by davmac, over 6 years ago:
Please see the
general guidance
for asking for help.
Accuracy Scoreboard Question
By weldon, with 2 replies.
Last reply by weldon, over 6 years ago:
Thanks, I adjusted it and it works now. I'm a bit new to Greenfoot, and I forgot that just using three instances of
Scoreboard
could be easier.
Strings Matching With Alphabet Question
By Zweeg, with 1 reply.
Replied to by danpost, over 6 years ago:
Zweeg wrote...
My code is supposed to recognize if a character in a string I input is a letter or if it is a number/character. I want to remove all numbers/characters and return a string with just the original letters. When I input "h" it returns "h". When I input "3" it returns "". However, when I input "h3" it returns as "h3" instead of just "h". Could you take a look at my code and see what the problem is? << Code Omitted >>
You will find that if you input "3h", it will return "h". In fact, if you input "1234567890h9876543210", it will return "h9876543210". It will return the inpu
Hey guys i want to connect greenfoot with arduino
By Alexlife2002003, with no replies.
Hey guys i want to connect greenfoot with arduino and i have no idea how like i mean i've read and stuff but i just can't get it and when ever my classmates and i ask our teacher he says "look it up".
Actor looking left/ right
By karlmell, with 1 reply.
Replied to by danpost, over 6 years ago:
karlmell wrote...
I need a code where an actor goes to a random place on the field. When the actor moves right the actor has to look right and when moves left has to look left. oh and this has to be done with a constructor. Without setRotation()
A constructor is for initialization of an object, for when the object is being created. An actor cannot yet be in any world during its execution. There is no apparent directional changes at that time. Using
setRotation
in a constructor will only internally set the actor's rotation for when it is finally placed into the world. It is onl
230
231
232
233
234
235
236
X