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
Just cannot figure out how to change worlds
By NotGoodAtThis, with 3 replies.
Last reply by danpost, about 6 years ago:
NotGoodAtThis wrote...
Solved that. I moved the world change code to an actor that sits on the world I want to move from.
There is an
act
method defined in the
greenfoot.World
class. You can override it (just like it is done in a class extending
greenfoot.Actor
) in your
TitleScreen
class. It is just not provided by the
World
subclass template as it is when you create a new subclass of
Actor
.
I am supposed to create a method that detects the nearest object (minnow) to another object (shark). The code seems to have some errors, but I am not able to compile it.
By Atharva1912, with 1 reply.
Replied to by danpost, about 6 years ago:
minnow
is of type
Actor
but,
nearest
is of type
Minnow
. You need to typecast
minnow
as type
Minnow
in order to set it to
nearest
. That is, line 13 needs to be as follows: <Code Omitted>Also, your method is supposed to return the nearest minnow; not the last one in the list.
double pendulum
By ronald, with 10 replies.
Last reply by ronald, about 6 years ago:
ok thank you
Using methods from another class
By resh47, with 1 reply.
Replied to by danpost, about 6 years ago:
In line 3, you need to typecast the world as a
GameWorld
object (just as in line 2). To avoid double work, you can set the world to an object reference variable prior to line 2: <Code Omitted>It allowed for the rest to be pretty short as one line, so I combined your lines 2 and 3 as my line 3.
Write a new public method in your Ocean class called addMinnow(). This method should pick a random x/y location in the ocean and add a single minnow there.
By Atharva1912, with 2 replies.
Last reply by Atharva1912, about 6 years ago:
Thanks a lot
Help with Shield for Asteroids
By elsmog, with 3 replies.
Last reply by danpost, about 6 years ago:
elsmog wrote...
I am wondering how to implement a shield that deflects asteroids rather than ignoring them, as I do now. << Code Omitted >>
This may not be quite so easy to do. Remember that both the asteroids and the rocket are drifting/moving. It may not be enough just to change the direction of a colliding asteroid. In my
asteroids
scenario, which has shielding implemented, I had both colliding actors change their trajectories with the help of a smooth moving system. You may want to take a look at its codes -- especially the
showText method in World class
By SnowFlurry, with 1 reply.
Replied to by danpost, about 6 years ago:
SnowFlurry wrote...
Does the showText method in the MyWorld class allow one to change the font and colour of the text?
No.
How can i spawn some things random ?
By schniggi, with 3 replies.
Last reply by danpost, about 6 years ago:
schniggi wrote...
Could you please send me an example i donn know how to write this correctly
What have you tried?
pendulum
By ronald, with 9 replies.
Last reply by ronald, about 6 years ago:
great, thank you
Need help on what codes to use for my game
By popo88, with 3 replies.
Last reply by danpost, about 6 years ago:
Well, get that much done so you have something to work with.
need help using MouseClicked method with an actor
By Joshua09, with 1 reply.
Replied to by danpost, about 6 years ago:
The
mouseClicked
method does not look for clicks on classes. It looks for clicks on a specific object (or any click when the argument is
null
). If the code given is in your
Block
class you can use
this
as the argument. For the world, you can simply use
getWorld()
for the argument.
Help!! Exercise 9.73 in book! Asteroids!.
By Daav3r, with 13 replies.
Last reply by Daav3r, about 6 years ago:
Aaa hahahah okey xd
Greenfoot database connection
By Manu3lll, with no replies.
Hello, Do anybody have a idea how to import the mysql-database driver into Greenfoot?
show bounding boxes and anchor points
By mich@elbecker.de, with 1 reply.
Replied to by danpost, about 6 years ago:
mich@elbecker.de wrote...
1. collision detection uses bounding boxes. Is it possible to show these bounding boxes around actors in the world?
The bounds are determined by the dimensions of the images set to the actors -- meaning the bounded areas are always rectangular.
2. Every actor has an anchor point. (I don't know whether this is the correct term; I mean the point that I set with Actor.setLocation(int x, int y).). Where is this anchor point in the image of the actor? Is it allways the center of the image?
Yes -- and no. There is no exact center along a dimension o
Logs in Frogger
By repertoire, with 1 reply.
Replied to by repertoire, about 6 years ago:
From restarting alot this is what i really have so far. Other than that i don't know where to go. <Code Omitted>
133
134
135
136
137
138
139
X