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 detect if all objects are gone
By Psg, with 11 replies.
Last reply by danpost, about 2 years ago:
Psg wrote...
hey, dan I need your help. I have a problem. I believe this if statement is working, but reading the wrong value of the integer rotate. What should i do
First, you should understand that the rotation is already being held in the Actor class, meaning you do not need to declare another field for it. You could use something like the following: <Code Omitted> It is not really clear by your code as to exactly what you are trying to achieve with the turn methods Obviously, you want the crab to turn sharp at an edge, whic
How to stop actors from "sliding" after calling the move() function and changing orientation
By TheGrrMan, with 5 replies.
Last reply by danpost, about 2 years ago:
TheGrrMan wrote...
your QActor class, how do I access this?
It can be found in my
Asteroids w/Improved QActor class
scenario. Again, it is not to be modified in any way -- just used as is. Download the scenario and open in greenfoot. Then, you can copy/paste the class into your scenario. It does work differently than the
SmoothMover
class, however. Open the class and read through the instructions carefully.
Actor
subclasses requiring it should extend the
QActor
class.
How do you rotate an object to spawn in a different way?
By zlm, with 2 replies.
Last reply by zlm, about 2 years ago:
Yes, thank you so much!
How do you make an object move along with another object
By jeremyneedshelp, with 1 reply.
Replied to by danpost, about 2 years ago:
jeremyneedshelp wrote...
I cannot make my frog to move along with the boat that allow the frog to cross the river. i managed to get the frog to go on top of the boat but it wouldnt move at all. it would just get stuck on the boat and it would die.
You need to show your current codes for both the frog and the boat. Also, you can look at other codes that do similar things. For example, my
Jump and Run Demo w/Moving Platform
scenario has an independently moving actor moving on a platform.
Adding a method to superclass Actor directly
By ChristophT, with 2 replies.
Last reply by ChristophT, about 2 years ago:
Thank you for your reply. At least I am not going to waste my time then. To bad, I can't do that however.
Gradually decrease and increasing speed
By lightbringer, with 4 replies.
Last reply by danpost, about 2 years ago:
lightbringer wrote...
cap out in a particular value
<Code Omitted> or <Code Omitted>
Need to execute sound.stop() once a sound has played through once
By lilnasX, with 1 reply.
Replied to by danpost, about 2 years ago:
lilnasX wrote...
I want the class to play through the wasted sound once, and then once it has finished playing play the gameOverBGM sound in a loop. However, the if statements condition is never met and the gameOverBGM line is never reached. I can't just input wasted.stop() after wasted.play otherwise the sound will not play through once and it will immediately play my gameOverBGM. need some advice, thanks. << Code Omitted >>
You cannot track the progress of the sound from the constructor of the class. Use the
act
method for this control. Also, line 22 is a bit redundant. T
Getting Neighbours with Certain Traits?
By Foofoo99, with 7 replies.
Last reply by Foofoo99, about 2 years ago:
Thank you so so much danpost! You have worked wonders in the progression of my remake of Stratego and I wish you a good night. I will try to let you know when the game is done.
Remove an Object when actor touches another object
By beaverboii, with 1 reply.
Replied to by danpost, about 2 years ago:
beaverboii wrote...
I want to remove a block when the main actor touches another block to open up a secret gateway in my game. Been trying to figure out how to do this for 4 class periods but my teacher and I don't know how to do it and the 15 yr old tutorials on YouTube don't help.
Best would probably be to have an
Actor
reference field in the
Block
class (or a special subclass of
Block
) to hold the
Block
object that special
Block
object is to remove. That way, when touched, it will know which one to remove.
Sending Information from one Actor to another
By Mordanto, with 1 reply.
Replied to by danpost, about 2 years ago:
Mordanto wrote...
I want to create an explosion by changing an image in the missile, but the "Gegner" checks whether the missile has hit him or not. I have done this because the Gegner's hp is deducted for this. But now I have to somehow tell the rocket to change its magic. << Code Omitted >>
The following will call a
public
method that you can put in the
Rocket
class: <Code Omitted>
Multiple constructor help
By KevinNavarro, with 1 reply.
Replied to by KevinNavarro, about 2 years ago:
I do not have a code yet because I do not know where to start
How can I make my stride program check if the answer is right?
By D0dZi3, with 1 reply.
Replied to by danpost, about 2 years ago:
D0dZi3 wrote...
Hey all, I am making for class a stride scenario program and I am trying to figure out how to make the program check if the answer is right or not and for it to output correct or false. Any help would be really appreciated
Will need to see your current codes to help.
Is it possible to create a timer or a block cade for the maximum number of objects?
By Mordanto, with 3 replies.
Last reply by danpost, about 2 years ago:
AlexMue wrote...
if i could get your email address i will send my file via email
If you have errors, you can post your classes here. If not, you can upload the scenario here with the "Publish source code" checkbox checked.
drop objects
By AlexMue, with 7 replies.
Last reply by danpost, about 2 years ago:
AlexMue wrote...
1.I want to insert a red banana when The Monkey It Velvet will no longer fall ten bananas from top to bottom, but 30 bananas
Not sure what you want here.
2.I would also like to add a timer. When you start the game it must count down from 1 minute to zero and when it hits zero the game must be over
That requires an
int
field to keep the count of act steps taken and a basic actor to display the time remaining based on that count.
3.When the game is over, it must say how many bananas you have collected
The
int
field in
Actor has been removed from the world error
By Makuro, with 2 replies.
Last reply by danpost, about 2 years ago:
Another way to "solve" this is to change line 44 in
Projectile
class to the following: <Code Omitted>
24
25
26
27
28
29
30
X