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
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 4 years ago:
holy crap ur a savior
Timer code
By siizwee, with 2 replies.
Last reply by siizwee, about 4 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 4 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 4 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 4 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 4 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 4 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 4 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, about 4 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, about 4 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, about 4 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, about 4 years ago:
Oke, thanks for your help
move actors
By Tlax, with 10 replies.
Last reply by Tlax, about 4 years ago:
thank you very much
how to
By Cz.Gamingz, with 1 reply.
Replied to by danpost, about 4 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, about 4 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.
53
54
55
56
57
58
59
X