This site requires JavaScript, please enable it in your browser!
Greenfoot back

What is happening right now?


reply to Help a gal

By danpost - 35 minutes ago
View tutorials (java and greenfoot along with videos) and taking advantage of API documenation (java and greenfoot).

reply to How to stop background music when my actor dies

By danpost - about 3 hours ago
mc09086 wrote...
So I need to create two public methods into the "MyWorld" class, on for and a second one for music.stop? And what do you mean by "cast" to your World? Thank you.
You would only need to create public method(s) if the GreenfootSound object was private. That is, as public, the GreenfootSound object would already be accessible; otherwise, you would need public method(s) to make them accessible (either with a getter method or with action method(s) to control the sound). As a public field, an actor in the world can get a reference to the GreenfootSound object with: <Code Omitted>which can be shortened to this: <Code Omitted>This presumes you named the GreenfootSound object in MyWorld as music: <Code Omitted> Actually, if you refrain from stopping the scenario in the actor class, you could add the following act method in the MyWorld class: <Code Omitted>and the music field can be made private (with no getter or action methods needed for the GreenfootSound object).

reply to How to know if an object is present in the World

By danpost - about 7 hours ago
If you have actors and references to them, then: <Code Omitted>will be true if actor is in the world (and false, if not).

reply to Score counter won't work

By danpost - about 8 hours ago
Prox276 wrote...
Ok, so now i've pasted the code in the beginning of the code of my actor "player1". So, what do I write in another actors code so that the actor changes p by (as example) 1?
Depends. If during colliion detection: <Code Omitted>Without collision detection, you will have to go through the world: <Code Omitted>

reply to Spawn actor a certain distance from other actor

By Prox276 - about 10 hours ago
Oh, I've already found it out myself. Thanks