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
Method depending on the world youre in
By HighIqE, with 3 replies.
Last reply by HighIqE, almost 3 years ago:
ty very much man.
I need Help about GetRandomNumber();
By D_BUSTER9, with 2 replies.
Last reply by D_BUSTER9, almost 3 years ago:
Ooooo, i see. Thank you very much bro :D
game won
By Tlax, with 3 replies.
Last reply by Spock47, about 3 years ago:
The hasWon method as given, will be returning true especially in the following cases: 1. If no balk exists at all. So, if there is no balk in the world, and the hasWon method is called, it will return true. So, depending on when you add the balks to the world, this can be your problem. You could either make sure that the method is only called after the balks has been added to the world (e.g. it should be ok, if the balks are added in the prepare method called from the constructor and the hasWon method is called from the act.) or add a check to the hasWon method that there have to exist balk
hey im trying to get this to do an animation but it just keeps bringing up an error
By whitecrow, with 5 replies.
Last reply by danpost, about 3 years ago:
The boolean
animateLeft
is not good enough for your needs. It only has two states, but you have 3 animation sets (left, right AND idle). An
int
value would be more appropriate to track which animation is being used. The best values for each set are '-1' for left, '0' for idle and '1' for right. By adding 1 to the animation set value, simple indices can be acquired (0, 1, and 2), which leads to the opportunity of placing the animation sets in an array. Sample code might look like this:
if loop not looping
By Aaron-aid, with 4 replies.
Last reply by Aaron-aid, about 3 years ago:
oooh, thanks man!
Change image of an actor from another class
By salim5112, with 5 replies.
Last reply by danpost, about 3 years ago:
salim5112 wrote...
thanks a lot
The last way is probably best as only one time is intersection checked, there.
Music doesn
By CodingCowgirl, with 2 replies.
Last reply by CodingCowgirl, about 3 years ago:
@danpost Thank you.
im having trouble creating a method that takes a class and sets its position
By Aaron-aid, with 2 replies.
Last reply by Aaron-aid, about 3 years ago:
holy crap ur a savior
Timer code
By siizwee, with 2 replies.
Last reply by siizwee, about 3 years ago:
thanks alot, your're thr best!!!!!
Hi, I am having trouble setting the image to rotate (be vertical) on the side walls (the vertical ones) to make a border with my obstacle class all the way around my world? I can't get it to work, please help.
By SportingLife7, with 2 replies.
Last reply by danpost, about 3 years ago:
For vertical image issue, you could just pass a
boolean
(true/false) value to the constructor indicating the image is to be rotated or not. Another way is the create a reference to those vertical actors before adding them into the world and turn then right there in the loop. For keystrokes, add an
act
method into your
Space
class to detect the possible keys. It would
essentially
be something like this (which is not complete in itself, but shows the easiest way to break down and detect the different key options):
Help im going insane about a Counter
By Monk_08, with 24 replies.
Last reply by Spock47, about 3 years ago:
I think you are now in the position for some refactoring. If I understand your scenario correctly, the robot is the "protagonist", the actor the player controls. So, it seems that the robot is the one that "owns" the money. 1. So naturally the moneyCounter should be moved to the Robot class. <Code Omitted>As you can see, the source code to manage the money counter already got simpl
How to initialize a variable
By miguelcosta, with 1 reply.
Replied to by danpost, about 3 years ago:
You must declare a variable before you can initialize it. However, you can place the initialization code on the same line as that which declares the variable. Example is shown in your own code at line 15, which declares the
healthG
variable as an
int
and tells java to initialize the field's value to
30
when created for a
HealthGirl
actor.
Abstract and super keyword
By Roshan123, with 9 replies.
Last reply by Roshan123, about 3 years ago:
danpost wrote...
If you want to modify what initially appears when you create a class, edit the
actorJava
and
worldJava
files in directory:
/greenfoot/lib/english/greenfoot/templates/
Very good! Finally u have learnt it! I m sorry....ignore the above message I m always thankful to u for helping me everytime
Idea
By footpickle, with 1 reply.
Replied to by danpost, about 3 years ago:
footpickle wrote...
I need an idea for a game, can someone please leave a suggestion?
How about improving on what you already have?
int variable does not update in another worlds
By miguelcosta, with 4 replies.
Last reply by danpost, about 3 years ago:
Change line 37 in
Oceano
class to: <Code Omitted>and add at line 39 in
Oceano
ckass: <Code Omitted> If creating the new
Oceano
object in
MyWorld
class, use: new Oceano(this) or, if in an
Actor
subclass with actor in world, use: new Ocean((MyWorld)getWorld())
47
48
49
50
51
52
53
X