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
How to fix scenario not working properly on browser?
By BillP101, with no replies.
Hello, my Solitaire scenario (https://www.greenfoot.org/scenarios/33256) that I published recently does not work properly on browser but works perfectly fine on Greenfoot app as I tested by downloading it on another computer and my own computer as well and I also tried using other browsers. From what I see so far everything breaks after you press play on the main menu on the browser. I made this scenario long ago so I don't remember much currently try to fix it but any help will be greatly appreciated.
Random Number in range
By S00pM4n, with 2 replies.
Last reply by danpost, 6 months ago:
S00pM4n wrote...
how do i generate a random number between 10 and 20 for example
<Code Omitted>
Object Does Not Appear Automatically
By hiiiimlynn, with 2 replies.
Last reply by hiiiimlynn, 6 months ago:
Super_Hippo wrote...
The ‘myDefense’ method is never executed.
oh my gosh you are right! i feel so silly. thank you so much for your time.
getting actor methods into world
By 196els11, with 1 reply.
Replied to by danpost, 6 months ago:
196els11 wrote...
I am trying to access my method spider from the actor class inside of the world class but i cant figure it out
Please provide all of world class codes. Signify where your attempt was made. Then provide the code of the method you are trying to access.
My hearts aren´t dissapearing
By daviddd, with 12 replies.
Last reply by danpost, 6 months ago:
daviddd. wrote...
also, when i pick the option medium or hard i still get 5 lives, i have 3, 1 heart(s) on the screen but i dont die after running out of them? sorry if im a bother
You have two fields that are to hold same value (well, supposed to -- at least). They are (1) the
health
field that the
Player
instance retains and (2) the
health
field that the
HealthBar
instance retains. To keep things simple, best is to limit yourself to one field per value. So, remove the one the player retains and move all health related code from the
Dungeon
Other
By Alexnikolaidou, with 1 reply.
Replied to by danpost, 6 months ago:
Alexnikolaidou wrote...
I have no syntax errors. How do I display the objects in my world ?
How to use the multiple parameter arrays?
By Cbazz, with 4 replies.
Last reply by Cbazz, 7 months ago:
Thanks!
Programm does´nt work in browser
By Tonomis, with 2 replies.
Last reply by Unknown_friend, 7 months ago:
Unfortunately it didn`t solve the problem. We uploaded a Version, in which we deleted the GifImage Class, and it shows the same error message.
I need help with my code
By GrDan, with 1 reply.
Replied to by Super_Hippo, 7 months ago:
You need to get a reference to the world to add the object to the world. An actor can receive a reference to the world it is currently in with the ‘getWorld’ method.
Im trying to make a platformer but there is a problem with some objects.
By Pls_help, with no replies.
Im trying to make a platformer (a recreation of meet the robinsons) and I have a few obstacles like crates what you can use to jump on top of. But after I did the code the box radius seems to be a bit too big and when I jump on the box and if I move again I fall right through the box. Code for main character: <Code Omitted>
Im trying to make a platformer and when i press start my chracter flies to the top of the screen pls help
By Pls_help, with 4 replies.
Last reply by Pls_help, 7 months ago:
I finally found the problem. Thanks.
my character stopped jumping and idk why
By Bashni, with 2 replies.
Last reply by danpost, 7 months ago:
Bashni wrote...
when I turn off one of the onGround(); it works but not when all are on anything I can do to fix this?
I suggest that you add a new class. A subclass of
Actor
called
Ground
that can be extended to all the objects that your character can stand or bop its head on (
Floor1
,
Platform
and
Platform2
). That way you only need to check for the
Ground
class instead of checking all three different types separately. Same for the collision offsets -- for each direction, you would only need one check for
Ground
class).
i need help, why sound keep playing when i clicked Play.class?
By Newrestar, with 2 replies.
Last reply by danpost, 7 months ago:
Newrestar wrote...
<< Code Omitted >>
A class is not an object that can be clicked on. Use a reference to the
Play
actor that is in your world.
How do I draw a circle?
By lvl30dragon, with 2 replies.
Last reply by lvl30dragon, 7 months ago:
danpost wrote...
lvl30dragon wrote...
I'm trying to draw a circle that increases in size with the middle always being the center of the screen, and then decreases in size by "erasing" the outer circle and then drawing an inner circle. However afaik building a circle using the drawOval method doesn't draw the circle from the center but the bottom left or upper left. how do I do this?
Just subtract half the size of the circle (the radius) from the x and y coordinates of the center. Use the results for the
drawOval
method call.
That works. Thanks!
get an actor's start location without hard coding
By NewUser567, with 1 reply.
Replied to by danpost, 7 months ago:
NewUser567 wrote...
If my actor touches a rock, it needs to go back to its starting coordinate and starting rotation. How can i get this without putting in the actual numbers?
You could save the initial location coordinates and rotation in fields when the actor is added into the world. Then (re)set location and rotation to those values when needed (hits rock).
2
3
4
5
6
7
8
X