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
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, 6 months ago:
Thanks!
Programm does´nt work in browser
By Tonomis, with 2 replies.
Last reply by Unknown_friend, 6 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, 6 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, 6 months ago:
I finally found the problem. Thanks.
my character stopped jumping and idk why
By Bashni, with 2 replies.
Last reply by danpost, 6 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, 6 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, 6 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, 6 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).
getting actor height from world class
By NewUser567, with 1 reply.
Replied to by danpost, 6 months ago:
NewUser567 wrote...
I want to use a for loop to insert a horizontal line of rocks as a border. How can i do this from the world class? I would need to get the actor’s width and height from the world class right? They have to all be at the same height, and right next to each other
Yes. You can get the dimensions of a rock before the loop: <Code Omitted>This should put them along
Gaining Health
By zehbi-tracker, with 1 reply.
Replied to by danpost, 6 months ago:
Maybe: <Code Omitted>
Pls help me I don't know what is wrong with my code.
By Need_Help, with 1 reply.
Replied to by danpost, 6 months ago:
Need_Help wrote...
Pls help me I don't know what is wrong with my code. << Code Omitted >> pls and thank you
How is it not working as you think it should?
2
3
4
5
6
7
8
X