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
Chopping up an image
By actinium, with 4 replies.
Last reply by actinium, over 12 years ago:
Thanks all, that looks like what i need danpost. Thanks also zamoht.
Failure to change
By ader108, with no replies.
In my game, the zombie is supposed to eat the NPCs and then turn them into another zombie. This used to work.. until in attempts to condense I combined the two NPC classes and the four Zombie classes. Currently it simply removes the object and adjusts its image to the zombie relating to the object removed. <Code Omitted>
Removing all objects
By bbwf, with 21 replies.
Last reply by danpost, over 12 years ago:
'return;' is just a statement that causes an immediate exit from the method that is currently executing. Placing it in your code prevents later statements in the method from executing.
How to get the Greep/Alien to go back to the ship after they get the tomato?
By sask_girlz_rock, with no replies.
I have got the alien to get the tomato, bounce off the water and only a few return back to the ship. how can get it to return to the ship without the command saying return to ship?
How do you get the score to reset when you reset the game?
By theuberjew, with no replies.
me and my friend are stuck on this.
Whats the code for putting a timer in greenfoot if there is one?
By theuberjew, with 2 replies.
Last reply by theuberjew, over 12 years ago:
thanks figured it out
Light Cycle AI
By m.legere1323, with 5 replies.
Last reply by wafflepudding, over 12 years ago:
oh okay. thanks man I'll go there
Click to add objects
By super_noob, with 6 replies.
Last reply by Zamoht, over 12 years ago:
I guess you could add my code to the world's act() method like this. public void act() { if (Greenfoot.mouseClicked(null)) { MouseInfo mouseInfo = Greenfoot.getMouseInfo(); int x = mouseInfo.getX(); int y = mouseInfo.getY(); addObject(new WhatEverClass(), x, y); } }
Delaying An Actor
By marzukr, with 3 replies.
Last reply by marzukr, over 12 years ago:
Never mind I fixed this by decreasing jp to -16. Thanks.
adding a counter and making it work
By ctgreenfoot, with 1 reply.
Replied to by vonmeth, over 12 years ago:
Find the code in the Crab class (it should be in a method that looks for the worm) where the crab 'eats' the Worm class. You will want to assign a new value to your counter there. Something like, " counter = counter + 1; ", or you can simplify that line and use the increment operator - "counter++;" - that will increase the counter by 1.
Shooting Problem
By Motifaded, with 3 replies.
Last reply by Motifaded, over 12 years ago:
I fixed the problem.
How to detect what object is currently using a global method?
By UnclePedro, with 2 replies.
Last reply by danpost, over 12 years ago:
I think that all you need is to put an instance boolean variable in the Enemy class, call it 'reversed'. Each object created from that class or any subclass will have a copy of that field for its use. You can also add the following method within the Enemy class to return the state of any object of that class (or subclass): <Code Omitted>Just change the state of the 'reversed' field every time you turn the object around.
Leaves and Wombats - Random Leaves
By Gruff757, with 4 replies.
Last reply by Gruff757, over 12 years ago:
It works now. Thanks a lot vonmeth! =)
Add Object Question
By mncomic, with 8 replies.
Last reply by mncomic, over 12 years ago:
Thanks everyone for your help...
Creating Objects
By Johnathon, with 6 replies.
Last reply by Zamoht, over 12 years ago:
Oh of course. To be honest I didn't understand the question, but danpost's code is definitely an easier way to approach this problem.
908
909
910
911
912
913
914
X