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
World Isn't Spawning New Actors
By BryanGSMST, with 2 replies.
Last reply by BryanGSMST, almost 11 years ago:
danpost wrote...
Line 18 is setting the value of 'j' to zero; so the condition in your next line, line 20, will always be 'false' ('j' will never be anything but zero). Declare 'j' outside of the method, changing it from a local variable to a instance field (a local variable exists until the method is exited, so the next time the method is executed the variable is re-created; an instance field exists as long as the object it belongs to exists -- in this case, your CrabWorld instance, or world object). After moving the line outside the method, you will need to reset the field to zero after ten
Invincibility?
By CKnox, with 4 replies.
Last reply by CKnox, almost 11 years ago:
Thankyou Hippo, it works now!
need help with loop
By mntng, with 13 replies.
Last reply by mntng, almost 11 years ago:
Actually, I just opened the file again, without changing anything, really. And... no problem exists. I don't know what happens, it just works again. But thank you guys, I really learn a lot from you.
lives counter not working
By wslade, with 15 replies.
Last reply by Super_Hippo, almost 11 years ago:
True, it checks both, but only if the first one is false. (At least I think that should be the logic.)
need help for assignment: loop for non-random chess pieces locations
By mntng, with 4 replies.
Last reply by davmac, almost 11 years ago:
Another way: you can loop from 0 to 31 to cover all squares, and maintain two variables - row and column - inside the loop (but declare them outside the loop!). During each iteration, increment the column, and if it reaches 8, reset it to 0 and increment the row.
gravity on my platformer not working right..
By bmw0045, with 1 reply.
Replied to by danpost, almost 11 years ago:
Chances are one or more of the images involved (his image, the ground image or both) have excess rows of transparent pixels that not actually part of the image portrayed, but still is part of the rectangle that makes up the image block. If that is the case, the images blocks will intersect before the actual images intersect which will cause the behavior you described. You can use an image editor (one that supports transparency) to remove any complete rows (or columns) along the edges of your image that are completely transparent. If you do not have an image editor the supports transparency,
I need help with Labels
By dassteffen, with 2 replies.
Last reply by Super_Hippo, almost 11 years ago:
You need to make a program... did you sleep in your lesson? ;)
making a working subclass of world (which is subclass of World)
By Alwin_Gerrits, with 20 replies.
Last reply by Alwin_Gerrits, almost 11 years ago:
YES! I FIXED IT! Turns out I was changing world twice, once to go to the menu-world and once to go to the level-world. However, because it's being given no time between the two changes. That way the world it changes to isn't the level world, but the menu-world. In the end I fixed it by putting a copy of the menu into an actor so I don't have to call two different worlds in succession. Even though I fixed it myself I couldn't have done it without you guys, so thanks guys!!
How would I make a win message?
By rrose5, with 2 replies.
Last reply by Super_Hippo, almost 11 years ago:
I think it would be much easier if you create a actor which uses the "You win" message as its image and display it when you reach you object. (Make sure the actor is the first in the 'setPaintOrder' method or remove all other actors.) If the game ends there and nothing else has to be there anyway, you could also just change the background of the world to this image and remove all actors from the world. With this, you won't create a (sometimes) annoying pop-up.
How would I go about making a checkpoint?
By rrose5, with 1 reply.
Replied to by Alwin_Gerrits, almost 11 years ago:
If the program simply is in one screen it's prety easy, just put in a command like <Code Omitted>Define the x and y-coördinates and you should be done. If it's something like a sidescrolling game that's a bit different.... you might want to rebuild the world in that case, but that's where some trouble might appear. Anyway, if you want more suggestions or something just post a short comment you need more help behind mine and you should be fine.
How do i use this?
By shadowfire_ew, with 1 reply.
Replied to by Alwin_Gerrits, almost 11 years ago:
You can create actors by right-clicking actor then making a subclass. When you do you also get the option to name it straight away and pick an image for it. Looking a bit further you can see you also have a 'World' class on the right. If you make a subclass of 'World' you can use the command super(x, y, a). Now I made it with these variables on purpose because the super command used like this will determine the size of the world you're gonna be using. variable x is the width of the world, variable y is the height of the world and a is the size of one pixel within your world. I would recomm
System cannot find the file specified (set image)
By csrgamer, with 4 replies.
Last reply by csrgamer, almost 11 years ago:
It happens with just that one image. Using the code worked perfectly though, and now I can even select it out of the set image finder. Thanks!
Linux, Greenfoot 2.4 GUI-Style
By leuveg, with 2 replies.
Last reply by leuveg, almost 11 years ago:
Oh well, i do not like the nimbus-Theme, it is to Mac-like. Big thx for the help! :D
End game after certain objects are all gone?
By user219, with 1 reply.
Replied to by Super_Hippo, almost 11 years ago:
<Code Omitted> 'getObjects(Class cls)' is a world method which returns a list of all actors of the given class (or null which returns all actors in the world). 'isEmpty()' checks whether or not the list is empty (=no worm is in the world).
Need help :)
By Alwin_Gerrits, with 7 replies.
Last reply by Alwin_Gerrits, almost 11 years ago:
Nvm about the new problem, I fixed it myself :). Turns out it doensn't change it's position per 1 then checks, but instead changes it's position jumpSpeed*2 times in an instant and then scans... even though I don't know the cause I allready fixed simular problem in the fall() code, so when I found the problem to be the same the solution was found prety fast :). Ty anyway :).
641
642
643
644
645
646
647
X