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 fix shaking objects
By Armetor, with 4 replies.
Last reply by Armetor, over 1 year ago:
Ohhhh ok that makes sense. Thank you so much!
Dark Maze
By CookieMonster, with 3 replies.
Last reply by danpost, over 1 year ago:
One way is demonstrated in my new scenario,
Dark Maze Demo
The
Light
class in the scenario (in the
Player
class) was modified to allow changing the range of illumination (strength of light). Also, the
Scroller
class was fitted to support non-scrolling areas along right and bottom edges of the world (a
crop
method was added).
Greyscaling an image
By LucarioCodes, with 2 replies.
Last reply by danpost, over 1 year ago:
LucarioCodes wrote...
Trying to make an image gray like an old photo, but I'm stuck. This is the code I have so far, where do I go from here?
Not tested, but I believe if you just add the three color parts together and divide by 3, then use that value for all three parts should be close to what you want: <Code Omitted>
Ok new problem
By SeargentMitchell, with 2 replies.
Last reply by SeargentMitchell, over 1 year ago:
thanks bruv
How would I go about initializing an actor in a world without using "new"?
By FJacobs, with 5 replies.
Last reply by danpost, over 1 year ago:
FJacobs wrote...
Wouldn't I have to initialize each world and object like: << Code Omitted
You do not have to initialize the player again (only initialized in the starting world). That is, your line 5 is not needed to put a player in a different world. The line I provide previously will move the player from one world to the next. The new world does not have to create another instance of a
PurpleGuy
object. If it would make things easier, you could add a method to the different worlds to help move the player into each world:
Hey guys bit of a problem
By SeargentMitchell, with 1 reply.
Replied to by danpost, over 1 year ago:
SeargentMitchell wrote...
I need help in making a working crosshair that follows the mouse and overwrites it too if possible. ... How would I go about making the crosshair
I do not believe greenfoot allows access to its
Component
objects; which means you cannot do anything about the cursor being used. You could create an
Actor
subclass whose behavior is to follow the mouse and whose instances have the crosshair image. You may want to increase the scenario speed a bit to help in delayed movement of the actor. There may not be a suitable mix of speed and performace for
How do I fix this null pointer execption?
By RomanDavis, with 8 replies.
Last reply by RomanDavis, over 1 year ago:
Thank you.
Lists
By A_User, with 1 reply.
Replied to by danpost, over 1 year ago:
A_User wrote...
How do you create a list l and then access a random element of that list?
The
java.util.List
class is abstract, which means you cannot directly create a
List
object from that class. You can create a
List
object via a non-abstract class that extends the
List
class, such as the
ArrayList
class): <Code Omitted>You could import the two packages: <Code Omitted>to simplify the line to: <Code Omitted>
Darkening and image
By LucarioCodes, with 2 replies.
Last reply by LucarioCodes, over 1 year 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, over 1 year 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, over 1 year 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, over 1 year 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, over 1 year 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, over 1 year 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, over 1 year ago:
Thank you so much! This helped a bunch, and saved a lot of time.
20
21
22
23
24
25
26
X