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
calling variable from new World subclass
By Alwin_Gerrits, with 13 replies.
Last reply by danpost, about 11 years ago:
Maybe, instead of creating a new main actor in the new level, you should be using the same main actor. That way any and all states for that actor are not lost. The code could look something like this (although, it would depend on what class you are changing worlds in):: <Code Omitted>This particular code would require that you had a method in your Level2 classes defined as follows (however, it could be defined more specifically as far as the cl
Image isn't appearing...
By BryanGSMST, with 2 replies.
Last reply by Super_Hippo, about 11 years ago:
I would suggest to comment out line 37 because I don't think that an array can be 'null'.
Variables Reset Glitch
By BlackBench, with 1 reply.
Replied to by danpost, about 11 years ago:
Every time you create a new Rock object, it, the new Rock object, receives its own 'L' and 'N' fields for its use. If you want all Rock objects to share the same 'L' and 'N' fields, they you need to declare them as static fields: <Code Omitted>Their default initial values will be zero; however, because the values of static fields are retained during resetting of the project, you should explicitly set them to zero in the constructor of your subclass of World, using: <Code Omitted>
Error when Bullet hits Asteroid.
By CKnox, with 2 replies.
Last reply by CKnox, about 11 years ago:
Thankyou you for pointing that out, I checked my Bullet code and there is no removal code there either. Thankyou
Enemy glitching
By A1234, with 8 replies.
Last reply by A1234, about 11 years ago:
Yeah, that seemed to fix it and now it is working completely fine. It is strange how that fixed it as before it was glitching like crazy! But thank you again :)
UILibrary scenario question
By murphys, with 4 replies.
Last reply by murphys, about 11 years ago:
Thank you. The code now works as expected.
Need help
By beginner, with 3 replies.
Last reply by danpost, about 11 years ago:
Couple of things here (ok, several): * filling the image with white is not necessary; the background image of the world is white by default, so, seeing through the unused portion of the image of the actor is not a problem (you can remove lines 10 and 11 above); * any triangle covering the drawn text will permamently destroy the text unless you draw the text after each triangle is drawn (copy, or move, lines 12 and 13 to line 39; * line 28 has 'img' refer to the image used for the actor; in other words, 'img' and 'getImage()' will both point to the same memory location where the image of the
Start/Stop Music when world is getting loaded.
By DerPonyFreund, with 4 replies.
Last reply by DerPonyFreund, about 11 years ago:
Okay, thx. I´ll try around a little bit with this.
Need help with Counter!!
By A1234, with 2 replies.
Last reply by A1234, about 11 years ago:
It works now! Thank you so much!!!
Is it possible to reconstruct World sub classes?
By forteddyt, with 2 replies.
Last reply by forteddyt, about 11 years ago:
Oh wow, I can't believe I didn't see that method :/. Thanks though, that's exactly what I was looking for. I was messing around with sub-sub classes of World and tried reconstructing it like that, but was calling just "new subSubClass();" instead of "Greenfoot.setWorld(new subSubClass());". Thanks for the quick and simple response! :D
How do i get an image to point the way it is moving?
By JamesHughes, with 10 replies.
Last reply by Alwin_Gerrits, about 11 years ago:
Obviously you can allso change the image to a mirrored one. You'll just have to put it instead of the getImage line.
We thought the same dan :). I just didn't write it down. But that put aside, I see how your code is better :).
World Isn't Spawning New Actors
By BryanGSMST, with 2 replies.
Last reply by BryanGSMST, about 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, about 11 years ago:
Thankyou Hippo, it works now!
need help with loop
By mntng, with 13 replies.
Last reply by mntng, about 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, about 11 years ago:
True, it checks both, but only if the first one is false. (At least I think that should be the logic.)
641
642
643
644
645
646
647
X