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
Trying to spawn 2 enemies when one is is killed
By adao3, with 1 reply.
Replied to by danpost, about 8 years ago:
One major problem is that
max
is a new variable every act cycle and is always initially set to
5
. Another issue with the current code is that as long as the number of
Enemy
object in the world is less than
max
,
max
will increase and always stay greater than the number of
Enemy
objects in the world. You can either add two Enemy object into the world at the same time or introduce a target field. However, maybe the best way is to override the removeObject method:
Having trouble with using a counter
By Alrightalright, with 1 reply.
Replied to by danpost, about 8 years ago:
All possible values for the counter are exhaustd by line 8 -- that is, the 3rd if block will never by executed. You can just remove the "else" from line 13, however, that code, as is, is a bit much. Try the following: <Code Omitted>Or, even shorter: <Code Omitted>
Null Pointer exception
By adao3, with 4 replies.
Last reply by adao3, about 8 years ago:
thank you that helped a ton
isKeyDown not working if key is held?
By ggongwer, with 1 reply.
Replied to by ggongwer, about 8 years ago:
Oops, never mind. I found it after all. If you are encountering this, the solution is at: https://www.greenfoot.org/doc/faq#macos-keys
Wall
By Dr.Dre, with 5 replies.
Last reply by Agent40, about 8 years ago:
In order for an object to not pass through an object of any kind you, it needs to receive the equal to opposite amount of force. This would be placed in the same area that the movement code is for each direction possible (or you can use a boolean to switch the values to add a bounce affect if it's an AI/Enemy).
Door opening
By Dr.Dre, with 2 replies.
Last reply by danpost, about 8 years ago:
Remove the word "boolean" from line 7. You are inadvertently creating a new variable there (which is NOT that declared on line 1). By removing the type on line 7, it will then refer to the one declared on line 1. Replace line 13 with the following: <Code Omitted>No
NullPointerException
error can then be caught here.
Attribute in ShowText?
By comlink, with 2 replies.
Last reply by comlink, about 8 years ago:
Thank You for answering, I'll try that out. That should be, what I was looking for :)
My tree fractaler isn't fractaling
By TheGoldenProof, with 3 replies.
Last reply by TheGoldenProof, about 8 years ago:
I got it all fixed. I ended up using vectors and drawLine() to make it instead of scaling and rotating rectangles. Basically restarted from scratch. I did use the addedToWorld() method to draw the trunk.
Inheritance of classes
By RevoltecX7, with 2 replies.
Last reply by RevoltecX7, about 8 years ago:
Yea, sorry. I forgot to change it(line 3), I have this problem, and I was try to find, why the hek it doesn't work. And yes is that what I looking for, thank you so much. Now it works perfectly! :)
Problem with walls in window
By RevoltecX7, with 8 replies.
Last reply by RevoltecX7, about 8 years ago:
Yeee, this exactly I was finding! Thank you so much :)
Save the progress.
By RevoltecX7, with 6 replies.
Last reply by RevoltecX7, about 8 years ago:
Oh, this is good one. This will help me a little :) But thanks! I will use this for now.
Actor get position from another actor
By RevoltecX7, with 8 replies.
Last reply by RevoltecX7, about 8 years ago:
Okay, I got it. Thanks! :) It's now working all what I want to do. Thanks for helps!
hitboxes
By mole2003, with 3 replies.
Last reply by Super_Hippo, about 8 years ago:
Copy the Collision class into your project and let all classes which need to perform the checks extend this class.
Drawing many lines between many points
By TheGoldenProof, with 1 reply.
Replied to by TheGoldenProof, about 8 years ago:
OK I fixed it. Changed my code to this (the part that fixed it was taking the GreenfootImage lines = ... and the setBackground(lines) out of the loop):
actors spawning in on a repeating cycle
By mole2003, with 9 replies.
Last reply by Super_Hippo, about 8 years ago:
Move both lines (remove the "private" in the beginning) to between line 34 and 35.
243
244
245
246
247
248
249
X