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
how to download older scenario
By Roshan123, with 2 replies.
Last reply by Roshan123, over 6 years ago:
thanks for reply
Left & Right facing images
By genju, with 15 replies.
Last reply by danpost, over 6 years ago:
I think if you renamed your
setImg
method more appropriately (like to, say,
loadImages
), you might see one problem. Let me point out that this particular method is invoked exactly one time, from the constructor of the class. The attack images will certainly not load if you apply conditions above and beyond what is required (what does "with enemy" have to do with what images are loaded --the
boolean
is always
false
during constructing anyway). You just need to load all images for
Blue
or all images for
Red
; then set the initial image for the actor.
Removing objects
By scaps, with 7 replies.
Last reply by scaps, over 6 years ago:
alright it worked thanks a billion
How can i get the height and width of an object in another class?
By cantmember, with 1 reply.
Replied to by danpost, over 6 years ago:
Enemy
is a
Class
name (or a
Type
). A class does not have an image. Instances created from the class do. Use
getOneIntersectingObject
to obtain a reference to the "seen"
Enemy
instance.
Continuation: accessing integers in other classes
By scaps, with 4 replies.
Last reply by scaps, over 6 years ago:
it worked thanks a million
Neat way of getting a character at a specific index?
By 444Jam444, with 2 replies.
Last reply by 444Jam444, over 6 years ago:
Thanks.
The "if" statement is not working this instance
By Top_Gerald, with 4 replies.
Last reply by Top_Gerald, over 6 years ago:
Thank you danpost for the comprehensive reply! Also, thanks Jarvissss for the attempt. I managed to get the code working by putting a "public void act()" into my world class and putting the "sourceSpawn" in there.
Need help with static method
By Shabaz616, with 2 replies.
Last reply by danpost, over 6 years ago:
MyWorld
is a
Class
name and only shares its name as the type of objects it creates. In general (that is, without specifically programmed restrictions), a class can create multiple objects. Given two worlds: <Code Omitted>The use of the
Class
name (or
Type
of object) is not sufficient to distinguish what world instance you might, say, want the width of.
How do i create a scenario?
By Spuddy34, with 6 replies.
Last reply by Spuddy34, over 6 years ago:
thanks
Accessing an integer from another class
By scaps, with 6 replies.
Last reply by scaps, over 6 years ago:
I went ahead and moved integer zombieskilled to MyWorld.
Once I add the this while loop the world never loads... help!
By Smizi, with 2 replies.
Last reply by Smizi, over 6 years ago:
thank you so much! I totally forgot about that
How do i make a simple memory card game?
By JollyGreenGiant, with 223 replies.
Last reply by danpost, over 6 years ago:
"&" is not an operator that compares. And you cannot compare a card (firstPicked) to a value (secondPicked.getValue()).
Remove objects using world class
By scrap69, with 11 replies.
Last reply by danpost, over 6 years ago:
scrap69 wrote...
do you know if it's possible to have the showText method have text in different colors?
I do not believe you can alter how
showText
displays the text. Please refer to my
Value Display Tutorial
scenario.
Variable not updating
By drayko543, with 1 reply.
Replied to by danpost, over 6 years ago:
drayko543 wrote...
I'm making a space invaders game and I want to put in a lives counter. I did this with a lives_left class which is a child of the player class.
If you mean lives_left extends player, then that is a problem. An extension of a class is to create instances of the class it extends, just with possible added (or modified) stuff. It could (1) add extra state (new fields); (2) add or modify behavior (new method or method override); or (3) any combination of (1) and (2) (including neither just to give special categorizing).
Greenfoot scenario not loading?
By lottie, with 5 replies.
Last reply by danpost, over 6 years ago:
In
MyWorld
class
addLeaves
method, your
while
loop's condition never changes. Execution gets caught in the loop because "i" is never greater than "18".
125
126
127
128
129
130
131
X