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
need help for assignment: loop for non-random chess pieces locations
By mntng, with 4 replies.
Last reply by davmac, about 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, about 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, about 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, about 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, about 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, about 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, about 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, about 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, about 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, about 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, about 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 :).
Code not working
By Blackop778, with 4 replies.
Last reply by Blackop778, about 11 years ago:
Yep it works. Thanks guys!
getting nullpointer exception
By ngokhale, with 6 replies.
Last reply by Super_Hippo, about 11 years ago:
Oh sorry, I said you should change the method to the following but because I failed with the ending 'code' tag, it wasn't visible... <Code Omitted> For your current problem, you can have a counter. So you can write, if the ball hits the edge, the counter is increased by one. If the counter is 1 now, change color to yellow, else you change it to red. When the ball hits the edge and the method that you use doesn't transport the ball to a region which is not detected as the edge, then you need
I keep getting a terminal error
By coder04, with 5 replies.
Last reply by NikZ, about 11 years ago:
danpost wrote...
Adding the actor twice will not throw an exception. The error is occurring in the MiniShip class, not the Ship class. Please show the code for that class; particularly the 'fire' and 'act' methods of that class. Use the 'code' link below the 'Post a reply' input box to insert your code into any posts.
Yeah, but if you want to have two shots, don't do that.
Need help with remove object
By Fulman, with 2 replies.
Last reply by Fulman, about 11 years ago:
Oh, thank you man, that was the problem. Did not see that i forgot that. :D
642
643
644
645
646
647
648
X