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
Random number generator influencing "isKeyDown"
By NotGoodAtThis, with 3 replies.
Last reply by danpost, over 6 years ago:
NotGoodAtThis wrote...
I want the output of the generator to be saved as a sting not an integers.
An
int
value can be converted to a
String
representation of that value at any time using
""+intValue
The blankclass will never be in the world. It's just so that both the input indicators and the player can inherit from it.
You still need to create one, nonetheless, for any random values to be generated. Also, nothing prevents two random values being the same.
World Limit
By GrucifyMe, with 2 replies.
Last reply by GrucifyMe, over 6 years ago:
Ok thank you, it worked, all I needed to do was to set the location to the bottom of the 80% of the world. Thanks, Danpost
resetting a game
By bangtan, with 1 reply.
Replied to by danpost, over 6 years ago:
bangtan wrote...
what code should I use if the retry actor was clicked and then it will reset the world
<Code Omitted>???
Sound Effect problem
By CieloMungcal, with 1 reply.
Replied to by danpost, over 6 years ago:
CieloMungcal wrote...
i placed a sound effect when an actor does an act and the sound seems to be playing over and over again while the actor is doin that act. i only need it to play once. for example when i shoot the sound wont stop until the shot disappears from the world
Instead of using
Greenfoot.playSound
, maintain a
GreenfootSound
object and
play
it when needed.
how do I check if an actor still exists
By bangtan, with 9 replies.
Last reply by bangtan, over 6 years ago:
thank you!!
Timer
By teesore, with 1 reply.
Replied to by danpost, over 6 years ago:
teesore wrote...
How can I set up a timer? Gimme the code pls thank you
Please refer to my
Value Display Tutorial
scenario..
program error idk how to fix HELP DANPOST!!!
By CieloMungcal, with 10 replies.
Last reply by danpost, over 6 years ago:
Did you correct my error on line 6 above where comma should be a dot before
getY
? Show entire class codes. --- OH ... and please use code tags.
Make actor bigger
By 108089, with 3 replies.
Last reply by danpost, over 6 years ago:
Line 10 is misplaced. It needs to be in a constructor block. Like this: <Code Omitted>The problem with it being in the act method is that you assign it an already scaled image and multiple scaling causes distortions. Your line 16 can simply be this: <Code Omitted>
How can I make a player shoot another object?
By teesore, with 1 reply.
Replied to by danpost, over 6 years ago:
Like
this
? (sort of)
java.lang.NullPointerException
By ezio4864, with 5 replies.
Last reply by ezio4864, over 6 years ago:
Thank you so much! Everything works perfectly now. I really appreciate it!
removing an actor after being hit by another actor for 3 times
By bangtan, with 10 replies.
Last reply by danpost, over 6 years ago:
Show complete class codes.
How can I horizontally flip a gif?
By CieloMungcal, with 2 replies.
Last reply by CieloMungcal, over 6 years ago:
thanks! i made two complete set of images
How can I make object disappear after it gets hit?
By teesore, with 1 reply.
Replied to by bangtan, over 6 years ago:
<Code Omitted>
How can i make my actor stay on platforms?
By YothMan, with 7 replies.
Last reply by YothMan, over 6 years ago:
CieloMungcal wrote...
private int vSpeed = 0; private int acceleration = 1; private int jumpHeight = -8; //makes actor jump if(Greenfoot.isKeyDown("up")) { vSpeed = jumpHeight; fall(); } //checks if standing on land boolean onGround() { Actor under = getOneObjectAtOffset(0, getImage().getHeight()/2, land.class); return under != null; } public void checkFalling() { if (onGround() == false) { fall(); } } //falling private void fall()
I don't know why it won't print... please assist
By ThatAsianPixel, with 8 replies.
Last reply by Blazer, over 6 years ago:
You could, alternatively, have a general class that extends
Actor
, from which
Blastoise
,
Charizard
, and
Venusaur
extend from. Then add instances of those classes to a
Cpu
class and a
Player
class. Doing so, subclasses of that general class can inherit methods from that general class. You could also override a method by using the naming the method with the same name. (subclasses are classes that extend another class. This other class is called a superclass, in case you didn't know :D) Less messier when implementing changes to your code
139
140
141
142
143
144
145
X