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
Multiple Lives
By massivassl, with 3 replies.
Last reply by danpost, almost 9 years ago:
massivassl wrote...
so how would i make make it such that all soldiers share the same counter?
One way is to make the field 'static'. But you must ensure that you zero the field in your initial world constructor or the value will carry over from game to game. However, if all soldiers are removed from the world when they die, you do not have to keep track of how many are still in the world. You can simply use the following in your World subclass act method: <Code Omitted>
Need for removedFromWorld(World world) callback method for Actors
By MrBradley, with 11 replies.
Last reply by MrBradley, almost 9 years ago:
Thanks, I think I'll use this approach. Have you seen my other post about retrieving stacked objects being non-deterministic? I have trying to come up with visualization scenarios for a Stacks using actors and these guys appear to be randomly selected from the list of objects at the same location... I'm wondering what performance improvements are gained by hashing (?) the actors into the set/list vs adding them either FIFO or FILO orders. Any way to specify a different collect class at runtime? Thanks again, Mr Bradley
Sound problem
By massivassl, with 5 replies.
Last reply by massivassl, almost 9 years ago:
ah that was it. the sounds folder had a copy in the desktop. the scream was saved into that one. thanks
Sharing variables through Actors
By bromung, with 7 replies.
Last reply by danpost, almost 9 years ago:
KevMscotland wrote...
I'm not entirely clear on what you want but I think it's something like this: <Image Omitted>
The detecting of 'space' being down will be triggered multiple times during a single press of the key. You would need a field to track the state of the key to determine the moment that the key goes down:
canSee method error even when Animal class is created
By sushma, with 2 replies.
Last reply by sushma, almost 9 years ago:
thank you for the solution
Workaround for double mouse input
By CubeGamer6, with 2 replies.
Last reply by CubeGamer6, almost 9 years ago:
danpost wrote...
You not only need to check which button was detected, but you also need to ask which mouse action was performed (pressing, dragging or releasing) -- you cannot just assume that the first is pressing and the next will be releasing.
I see. So that means i have to use the Greenfoot.mousePressed(), Greenfoot.mouseClicked(), etc to determine what happened. Thanks for the reply!
How To Expand Commands
By CavemanWrath, with 2 replies.
Last reply by CavemanWrath, almost 9 years ago:
That worked like a charm. Thanks
Stop actors from spawning on top of one actor?
By Recorsi, with 48 replies.
Last reply by Recorsi, almost 9 years ago:
danpost wrote...
Recorsi wrote...
Shouldn't it message me once then?
Not unless you move the print line down to outside the 'if' block.
i tried putting it in the act method, it still didn't work.
Show how used in act. Did you run the scenario or hit the 'Act' button a few times?
Ok nevermind it works now. I moved the act method up, maybe that was the problem. Thanks danpost & Hippo :)
What is this code means?
By agiastaee, with 1 reply.
Replied to by danpost, almost 9 years ago:
agiastaee wrote...
whats "this." part mean ? <Code Omitted>
It means the same thing as: <Code Omitted>provided that 'frame' is not declared as a local variable within the block of code. That is, 'frame' is a predefined instance field. The 'this.' part is implicitly understood from within a non-static method when not explicitly given, It refers to the object created from the class that the method is being executed for (or on). All non-static methods (and constructor blocks) are executed on or for an instance (whether new or not) of the class. Field reference
Stopping every sound at once?
By Recorsi, with 2 replies.
Last reply by Recorsi, almost 9 years ago:
Works great thanks :)
ArrayList error
By CavemanWrath, with 2 replies.
Last reply by CavemanWrath, almost 9 years ago:
I don't exactly remember but whatever I did fixed it. It is very possible that I will run across some more bugs with it in the future though.
Changing an int to a double using two methods
By dbutts1@stumail.com, with 5 replies.
Last reply by dbutts1@stumail.com, almost 9 years ago:
Thank You
Integer not returning
By WardedBowl403, with 4 replies.
Last reply by WardedBowl403, almost 9 years ago:
Super_Hippo wrote...
As far as I know, that only happens when you right click the object and choose the method. I am happy that not every method call creates a pop up window to be honest.
Hmm okay. The computers at my school always create a popup when a function with a return type that isnt void is called. I guess those computers are also running and older version of greenfoot. Thanks for the help, I was very confused.
Greenfoot 6.34 Bubbles size and direction
By dbutts1@stumail.com, with 10 replies.
Last reply by dbutts1@stumail.com, almost 9 years ago:
Okay, Thank you very much.
Get Objects that aren't actors
By NoaSakurajin, with 7 replies.
Last reply by Super_Hippo, almost 9 years ago:
Well, you could add another 'in the world' at the end of the first sentence if it isn't clear to you. It really wouldn't make much sense if the world keeps a reference to all objects which are created (but not added to world) and doesn't ever remove the reference.
303
304
305
306
307
308
309
X