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
what would i do to get enemies to not collide with each other?
By nathen, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
Maybe something like: <Code Omitted>
Need help with mp3 player code
By miahg17, with 9 replies.
Last reply by miahg17, almost 10 years ago:
I just added private int masterVolume to the code. I use it as comparitor in all volume related if statements and add adjustment before referencing in setVolume(). I use it as reference in the volBar method and the volume bar adjusts up and down as it changes. Works like a charm. Thanks again for the help guys.
How to jump more in a curve?
By Jochends, with 3 replies.
Last reply by danpost, almost 10 years ago:
Jochends wrote...
If i try the following code he doesn't recognize it <Code Omitted>
You placed the portion of code after the wrong character.
Getting the coordinates of an object
By LimeLava, with 19 replies.
Last reply by danpost, almost 10 years ago:
LimeLava wrote...
I had a problem with the code where for this <Code Omitted>Said incompatible types for "(0)"
The compiler only knows the element as of type Object and I forgot to tell it that the object was an Actor object. Change the line to this: <Code Omitted>
How to change position of an actor?
By Astralman, with 1 reply.
Replied to by danpost, almost 10 years ago:
If this is for the permanent image the actor is to take on throughout gameplay, then use an image editor, rotate it and save it. If this is something for during gameplay, then you would have to do it programmatically. If the width and height of the image are the same size, then 'getImage().rotate(270)' may be all you need to do. Otherwise, you would have to draw the image on a large square image, rotate it and then re-draw it on an image whose dimensions are switched from the original image.
Error with context
By wlau1010, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
'Wall' is a class, not an object. You can't get the position of a class. Instead, you need to get a reference to the object(s) and call the method on that.
how to change the direction of moving forward?
By Sk1llG4m3r, with 1 reply.
Replied to by danpost, almost 10 years ago:
You can use the 'setLocation' method for movement or you can save the rotation in a field and set the actor to that rotation at the beginning of the act method and save it and reset the rotation back to zero at the end of it: <Code Omitted>
Let the actor do something if he is on a specific position
By Sk1llG4m3r, with 1 reply.
Replied to by danpost, almost 10 years ago:
Add an actor to act as a door or gateway. It can have an image or be transparent. It can have a reference field to hold the world it leads to and check for the actor to contact it and change to that world. Its class code could be like this:
ran into another problem need help
By nathen, with no replies.
im trying to get a destruction animation after i shoot a bug here is my code <Code Omitted>
Best way to get the projectile to Fire in a certain direction.
By dlamc, with 3 replies.
Last reply by danpost, almost 10 years ago:
dlamc wrote...
I think I understand what your change does, but I'm still learning Greenfoot's syntax. Could you/someone explain to me what this code does just to make sure I understand?
Line 1 creates the Bullet object and stores it in an object reference variable 'bullet' which is declared to hold an object of type 'Bullet'. Line 2 adds the bullet into the world at the location of the tank. Line 3 sets the rotation of the bullet to that of the tank. I could have spent lines of code on it like this:
Scenarios
By Nosson1459, with no replies.
Is it possible to run scenarios in Google Chrome and Microsoft Edge or only in Internet Explorer?
How come, if Java is stored on the Local Disk (C:) (not on network (which it can't be anyway)) I have to go to the Java Control Panel Item and put in the Greenfoot website on each user separately (same Java why different security)?
array required but String found
By divinity, with 15 replies.
Last reply by danpost, almost 10 years ago:
divinity wrote...
in my ide it is saying line 37
What does it say about line 37 (hover over it?)
Controls not working and can't find why, also implementing a floor?
By Baguette, with 2 replies.
Last reply by Baguette, almost 10 years ago:
Works brilliantly! Thank you very much. I'm sure I'll be back with more questions. Thanks for a swift response too!
i need help slowing down the transition between two images to create an animation
By nathen, with 2 replies.
Last reply by nathen, almost 10 years ago:
thank you!
Continuos Gaming
By lolitsme, with 1 reply.
Replied to by danpost, almost 10 years ago:
lolitsme wrote...
So I am making a zombie game that once my actor enters a door it moves to the next level. The problems is I don't know what are the codes that once I run my program I can play it wherein I don't have to stop it just to move to the next level.
I will presume that your levels are in different World subclasses. If so, then use the Greenfoot class method 'setWorld': <Code Omitted>
427
428
429
430
431
432
433
X