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 create levels of a game?
By ShauryaThapan, with 2 replies.
Last reply by danpost, almost 6 years ago:
Oftentimes, the inclusion of
static
fields (class variables) in your
MyWorld
class is sufficient to allow the game to become more difficult from one world instance to the next. Some
static final
fields (class constants) can be used to describe the initial set-up of a "level". One
static
field (variable) would be used to track which level is current.
Acceleration, Collision and and Walljumps?
By Pumk!n, with 2 replies.
Last reply by RcCookie, almost 6 years ago:
To actually implement the moving system, you need to save your speed from frame to frame:
Methods and method signatures
By Ojhayvee, with 1 reply.
Replied to by danpost, almost 6 years ago:
Ojhayvee wrote...
What would be the method signatures for; 1. setLocation(); 2. getX(); 3. getY();
An example is given in the first section of
this
page of the java tutorials.
Not able to create a score counter
By Coder12341234, with 5 replies.
Last reply by danpost, almost 6 years ago:
The problem is that you have two (2) methods that could potentially remove the actor from the world, you call them unconditionally and they both require that the actor be in the world when called. You could use an if statement to place the condition of the second calling that the actor be in the world, as such: <Code Omitted>However, if you decide to rearrange things, it may cause issues again. Better, would be to start both methods,
removeEnemy
and
hitByProjectile
, with the following line:
Need help with WBC-4 chapter 5 Greenfoot Homework!
By TheHDMICord, with 2 replies.
Last reply by TheHDMICord, almost 6 years ago:
That seems to have fixed the issue! Thank you so much danpost, you're an absolute lifesaver!
Why is this spawning in before I press "f"?
By Pumk!n, with 2 replies.
Last reply by Pumk!n, almost 6 years ago:
thank you so much, I am pretty new to this, so thanks
How can i change the background during game
By alicia007, with 1 reply.
Replied to by danpost, almost 6 years ago:
alicia007 wrote...
i want to change the background during my game at a specific action.
Use this
setBackground
method or this
setBackground
method.
Newton's Lab: this(new Vector()) what does this mean??
By disassociated, with 5 replies.
Last reply by danpost, almost 6 years ago:
disassociated wrote...
Can you open that up or give a hint about the concept where I can read more? The run sequence is like this right? Space/ Constructor Vector / Constructor SmoothMover / Constructor Body / Constructor
Let me just point out a thing here. When an
Object
instance is created, it is created from the bottom up. All extending classes are built on their supers. So, when you create a body, the
SmoothMover
portion is created before the
Body
portion. Think of it as such that the
Body
object inherits pre-defined traits provided by the
Smo
Greenfoot code
By Sauravbasyalking12, with 5 replies.
Last reply by Sauravbasyalking12, almost 6 years ago:
Thank you so much dan I got it
The jump should be made slower
By Flantox, with 1 reply.
Replied to by danpost, almost 6 years ago:
The one way that will most surely work is to use a smooth movement system on the actor so that you can use a "fractional" acceleration value. A slower than one acceleration will make your actor jump a bit higher, while doing so at a slower speed. See my
GQActor Superclass Demo
scenario for a demo (or download to look at or use). Adjust the gravity value, which is vertical acceleration, for the effect.
little-crab scenario
By Codec, with 5 replies.
Last reply by Codec, almost 6 years ago:
Thanks guys it worked.
Greenfoot code
By Sauravbasyalking12, with 2 replies.
Last reply by Sauravbasyalking12, almost 6 years ago:
Thank you so much kostya
How to start music if the scenario runs?
By TerminatorHD, with 19 replies.
Last reply by danpost, almost 6 years ago:
TerminatorHD wrote...
Yeah sure, I will look into it. Would you tell me how I can interact with my classes? I thought its public first but I didn't found anything. So..should I use "static" for those purposes?
Again, probably not. But, cannot tell for sure. Must be considered individually.
How to use getNeighbours() to check if any of the neighbours are from a specific class
By MonkeiProtecc, with 5 replies.
Last reply by danpost, almost 6 years ago:
MonkeiProtecc wrote...
<< Quote Omitted >> so what does this exactly do? So i can understand it :). Also what I meant was i want to check all the 8 neighbours of a black cell. And for every white neighbour within the 8 cells, a variable (i) should increase by 1.
Well, your title suggested you wanted to know if any White objects were neighbouriing a Black (order of colors not being pertinent). However, now you specify you need a count of them. For number of neighbors: <Code Omitted>This will give the current number of Wh
Embed Greenfoot Program into my new created website
By Bolla13, with no replies.
Is it somehow possible (I hope it is :-)), that I embed my Greenfoot program into a self-created website, like you are doing here. Is there a manual for this. Thanks for your help
112
113
114
115
116
117
118
X