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 initialize a variable
By miguelcosta, with 1 reply.
Replied to by danpost, almost 5 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, almost 5 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, almost 5 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, almost 5 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())
Help with x and y coordinates
By TimFNA, with 1 reply.
Replied to by danpost, almost 5 years ago:
You mention bullet hitting a P1 object, but I only see code for hitting a P2 object.
stops movement
By Tlax, with 3 replies.
Last reply by danpost, almost 5 years ago:
Tlax wrote...
how do i manage to start balk moving again when i pres the mouse again?
Change line 6 to: <Code Omitted>
getRandomNumber
By Tlax, with 2 replies.
Last reply by danpost, almost 5 years ago:
Tlax wrote...
But if i type the y in for all the actors they get a randomnumber, but its the same for all the actors. I would like to have a different y for every actor
Please provide the code in question (the more, the better).
How can a share a variable between world class an actor class
By KasB, with 9 replies.
Last reply by KasB, almost 5 years ago:
Oke, thanks for your help
move actors
By Tlax, with 10 replies.
Last reply by Tlax, almost 5 years ago:
thank you very much
how to
By Cz.Gamingz, with 1 reply.
Replied to by danpost, almost 5 years ago:
Cz.Gamingz wrote...
hi pls help im hiring for the command : how to make a actor to eat anothe actor
There are the
isTouching(Class)
and
removeTouching(Class)
methods.
NullPointerException when trying to find Axis of an actor
By Hashe, with 1 reply.
Replied to by danpost, almost 5 years ago:
In
GameWorld
class, line 17 declares a local variable called
s1
which overshadows the instance field declared on line 3. Remove the declaring type on line 17 (the first word) so that the instance field gets assigned the object created.
i get a weird sound when i copy on greenfoot
By siizwee, with 2 replies.
Last reply by siizwee, almost 5 years ago:
thanks Dan!!!
How do i get my variable to add 1 each time i click?
By jeppe9756, with 5 replies.
Last reply by danpost, almost 5 years ago:
Gabe1098 wrote...
<Code Omitted>
Does not help. Invalid parameter; and ";" would be expected before "{".
lists and objects?
By Aaron-aid, with 1 reply.
Replied to by danpost, almost 5 years ago:
Call the list
items
(with the "s" at the end). Declare it as <Code Omitted>Remove the collision code from the
item
class and put it in the
player
class: <Code Omitted>Then, you can just use, <Code Omitted>where the list is not empty and
n
is between 0, inclusive and the
size
of the list, exclusive; plus
x
and
y
are
Need help in programming a racegame for my school lessons
By PepeSbczk, with 4 replies.
Last reply by danpost, almost 5 years ago:
Aaron-aid wrote...
i made a kind of smooth driving thing with open source you could check out https://www.greenfoot.org/scenarios/28859
I am sorry to say that at the moment, I do not have any demos on controlling a car. That would be something to consider. At any rate, your smoothness is not that great. At slow speed, only few angles of movement will be achieved. Also, the turn rate should be governed by the speed -- not just to turn or not turn, but how much turn allowed dependent on speed (no speed means no turn; slow speeds would be close to maximum turn -- minimum radius turn
55
56
57
58
59
60
61
X