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
Darkening and image
By LucarioCodes, with 2 replies.
Last reply by LucarioCodes, almost 2 years ago:
Thanks for the help! Can't believe I missed that!
How do I make an Actor follow another Actor?
By FJacobs, with 1 reply.
Replied to by danpost, almost 2 years ago:
FJacobs wrote...
How do I make an Actor follow another Actor?
First, get a reference to the actor it wants to follow; then, turn toward it and move toward it. Depending on your scenario, you may need to reset the rotation of the follower back to zero to complete the steps involved. If the follower moves at a slow rate (certainly, if less than 5 pixels per move), you might consider using a smooth mover support class to eliminate any inaccuracies in moving direction.
wait()...or other?
By A_User, with 2 replies.
Last reply by A_User, almost 2 years ago:
Thanks!
How do i carry the variable health from one world to a new instance of the same world?
By ReasonedTiger39, with 1 reply.
Replied to by danpost, almost 2 years ago:
ReasonedTiger39 wrote...
In my game, you are supposed to kill all the enemies and go through doors to get to another world. However, that new world is the same world as the starting world, just a new instance. However, when i go through a door, the Health of the player resets. How do i make the health the same as the health in the previous world? << Codes Omitted >>
Replace lines 31 thru 34 in your
MyWorld
class above with: <Code Omitted> Then, add the following to the
MyWorld
my game is laggy only the the greenfoot website
By moltenmaster, with 4 replies.
Last reply by danpost, almost 2 years ago:
moltenmaster wrote...
@danpost
If I knew what it was, I would have said so. Since I do not, there is nothing to say currently. It could be anything from too many actors in the world to loading music files frequently to who knows what.
Error when i try to make a subclass "villager" under my superclass "Pedestrian"
By KCee, with 1 reply.
Replied to by danpost, almost 2 years ago:
KCee wrote...
When i try to create a subclass called Villager under my superclass Pedestrian it says "constructor Pedestrian in class Pedestrian cannot be applied to given types" and i dont know whats the issue << Codes Omitted >>
You currently cannot create a
Pedestrian
object (which includes a
Villager
object) without a direction parameter. The simplest way to rectify the situation is to add the following to the
Pedestrian
class: <Code Omitted>Now when created without the direction, it passes control to the constructor w
How to Find Coordinates in the Scenario?
By FJacobs, with 2 replies.
Last reply by FJacobs, almost 2 years ago:
Thank you so much! This helped a bunch, and saved a lot of time.
how do you have an actor shoot if and only if another actor is on screen
By envxity, with 6 replies.
Last reply by danpost, almost 2 years ago:
envxity wrote...
1 last question is it possible to make the bullet fire to the enemy as well?
What mechanism do you want for aiming and triggering?
I need help with my brick breakers game.
By 76REINS, with 1 reply.
Replied to by danpost, almost 2 years ago:
76REINS wrote...
I am having trouble spacing the lifetokens(Orange Balls) apart from each other
You may want to see my
Value Display Tutorial
scenario. It has a section on non-textual display of values and specifically touches on this type of visual counter.
Why is this giving me a nullPointerExeption?
By ReasonedTiger39, with 3 replies.
Last reply by ReasonedTiger39, almost 2 years ago:
Thanks! I have solved the problem. Sorry for the late response.
image.getheight need help
By pxtchey, with 2 replies.
Last reply by danpost, almost 2 years ago:
pxtchey wrote...
+ image.getHeight() is throwing a error saying its retrieving a value when its supposed to be a variable if you need the full code for this just let me now
The equal sign on line 23 is the problem.
How can I travel between game levels efficiently without a world for "You beat the level"for each level?
By GreenFinger, with 2 replies.
Last reply by GreenFinger, almost 2 years ago:
Thank you a lot!
My Actors dissapear after pressing act or run
By Shaormentiul, with 14 replies.
Last reply by danpost, almost 2 years ago:
Shaormentiul wrote...
It might be because I used the same variables in Attack ( the one that I duplicated) but they are private so I dont think thats the problem And Attack2 is just an object I used to see if it would dissapear as well Its not supposed to actually stay on the Scene
The problem is with the code in your
Attack
and
Attack2
act
methods. The 300 milliseconds is 3/10 of one second -- and, you have the object being removed from the time it was created. Well, the internal clock of the computer continues to run even when your scenario is not running.
Game Only Works After Closing Greenfoot
By moko, with 1 reply.
Replied to by Spock47, almost 2 years ago:
This kind of problems often occurs when static attributes are used. (e.g. "TestWorld.notes" should be non-static). A static attribute is bound to the class itself instead of the object. So, if you have two testworlds, the static modifier means that you have only one value for notes that is used by both testworlds. So, if notes is changed by one testworld, the change interferes with the other testworld, too. Especially, if you restart your program and a new testworld object is created, it still continues to use the same (already used) notes value that was used in the first run. In constr
How to Append Text to an Existing File in Java
By Niru, with 2 replies.
Last reply by Niru, almost 2 years ago:
Spock47 wrote...
You can give the writeString method additional arguments to define how the file is opened. The default is that it "overrides" the file content. By adding the option "APPEND", it will instead append the new text at the end of the file. So, please change line 21 to the following and check whether it works as you want: <Code Omitted> Note: Propably you will have to add the following import statement at the top of your source code: <Code Omitted> Live long and prosper, Spock
22
23
24
25
26
27
28
X