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
Accesing a method from another Actor
By Banchion, with 3 replies.
Last reply by nolttr21, almost 8 years ago:
right after the "int a = 0;" line add this line without the quotes: "public boolean clickedOnce = false;" then use this code in place of your Click() method <Code Omitted>
how do i make this character jump
By JoyBajwa, with 3 replies.
Last reply by danpost, almost 8 years ago:
JoyBajwa wrote...
I am new to programing and I want to make the character jump and i want to learn how you made your game so may please request to see the code of you game so I can learn from my mistakes. Ill also upload my game after its finished.
You can click the buttons along the bottom of the window while running the scenario to view the codes used.
Move multiple actors including constructors
By HugoTroop, with 1 reply.
Replied to by danpost, almost 8 years ago:
Constructors, in general, do not have anything to do with any actors in the world. I do not understand what you mean by "movement is done in a constructor". Certainly, the object being created is not yet in any world; so, "movement" is meaningless for it at the time the constructor executes. The turrets need to keep a reference to the hull they belong to so they can move with them.
help!!
By agray11202, with 1 reply.
Replied to by Super_Hippo, almost 8 years ago:
The size of an actor is defined with its image. So if you change the size of the image, the size of the actor changes as well.
Multiple Lives
By massivassl, with 3 replies.
Last reply by danpost, almost 8 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 8 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 8 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 8 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 8 years ago:
thank you for the solution
Workaround for double mouse input
By CubeGamer6, with 2 replies.
Last reply by CubeGamer6, almost 8 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 8 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 8 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 8 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 8 years ago:
Works great thanks :)
ArrayList error
By CavemanWrath, with 2 replies.
Last reply by CavemanWrath, almost 8 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.
301
302
303
304
305
306
307
X