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 make ai fire at the player's spaceship?
By Jol159, with 9 replies.
Last reply by danpost, over 8 years ago:
Jol159 wrote...
It works but no idea what if statement to use to stop the laserbeams from spawning like mad. Any ideas?
It depends on what behavior you are wanting -- periodic or random timing of shots would be one unknown; if periodic, how often would be another unknown; if random, the possible ranges in timing would be the second unknown.
Horrible lag in game
By CubeGamer6, with 2 replies.
Last reply by danpost, over 8 years ago:
Why do you want to create so many laser pulses? You could lengthen the pulses and create less of them all the way up to just creating one laser (see my
Laser Demo
scenario where each line is one Beam object).
How to make inject move auto, but not transparent other object
By Mohhaer, with 1 reply.
Replied to by Jol159, over 8 years ago:
<Code Omitted>The code above will move the spaceship when the code is run at a speed of 2. It will also reset the spaceship to the specified location if it reaches the edge of the game world. Hope this helps a bit!
How to make object move auto, but not transparent other object?
By Mohhaer, with 2 replies.
Last reply by Jol159, over 8 years ago:
Mohhaer wrote...
Help me please
<Code Omitted>The code above will move the spaceship when the code is run at a speed of 2. It will also reset the spaceship to the specified location if it reaches the edge of the game world. Hope this helps a bit!
Hoe to add an object into the World?
By TomazVDSN, with 4 replies.
Last reply by TomazVDSN, over 8 years ago:
Hi, danpost. I want to addObject "a WaterMelon" to the world programmatically, where should I put the method? The code below is not working.
Change "this" in Greenfoot.mouseMoved(this) to an object like bee1 from class Bee
By SomeoneThatNeedsHelp, with 1 reply.
Replied to by danpost, over 8 years ago:
Try: <Code Omitted>This will get a list of Bee objects in the world and find where that particular bee is in the list. As long as no Bee object is removed from the world, the list should be created the same way every time.
Greenfoot error
By KKobra, with 3 replies.
Last reply by davmac, over 8 years ago:
Ok, then I guess problem solved (for now)? If it happens again and you figure out a way to provoke it, please contact us via the support email address (support@greenfoot.org).
Having trouble with finding a method from another subclass and calling it
By Dabigbluebass, with 2 replies.
Last reply by Dabigbluebass, over 8 years ago:
Thanks a lot, works great now
Indefinite adding of object.
By Ruskii, with 2 replies.
Last reply by Ruskii, over 8 years ago:
Yehuda wrote...
Add a condition to the if-statement that (the block should be executed) only when there are no GatewayTwo Objects in the World, that way if there is (at least) one already no more will be added.
Thank you for the response; it works perfectly.
Non static method cannot be referenced from a static context
By IlikeThePrequels, with 4 replies.
Last reply by danpost, over 8 years ago:
IlikeThePrequels wrote...
Here is my obtainCounter() method << Code Omitted >>
That counter is belongs to your
Fields
object -- not to your
Fields
class. You cannot access it through the class; you can only get it by way of the
Fields
object create by the class -- the
World
object your actors are/were in. That means you need to retain that
Fields
object before removing
this
from the world. Try this:
I'm trying to add a gameover screen and a score counter.
By IlikeThePrequels, with 2 replies.
Last reply by danpost, over 8 years ago:
IlikeThePrequels wrote...
I figured out how to add a game over screen but still need help adding a scorecounter. Can anyone please help?
Is this the same score counter being worked on in your other discussion thread?
issues with Greenfoot.mouseClicked
By knuckels5739, with 3 replies.
Last reply by danpost, over 8 years ago:
knuckels5739 wrote...
how do i label the object as b1 instead of using "this" because puting b1 in (Greenfoot.mouseClicked(b1)) would give error
Insufficient context given to answer. (what class the given code is in; what b1 and b2 refer to; what error was given; ...)
Danpost explanation?
By maboidanpost, with 2 replies.
Last reply by maboidanpost, over 8 years ago:
My bad, I'm stupid. Thanks for info.
What does this variable evaluate to?
By suzbo, with 3 replies.
Last reply by suzbo, over 8 years ago:
Thank you so much for that explanation.
help with array
By maboidanpost, with 3 replies.
Last reply by danpost, over 8 years ago:
maboidanpost wrote...
How could I "make a number" using this array. ...
You do not need an array of type char. What you need is an array of type GreenfootImage for the images representing the digits of the number. That way you can calculate the length of the final image, create the final image and draw the digits onto it:
268
269
270
271
272
273
274
X