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
Counter for lives not incrementing or decrementing.
By Notted, with 23 replies.
Last reply by Notted, over 7 years ago:
Notted wrote...
Strange. After doing a bit of debugging, I found that bombBoom never returns true; it's always false, even when the bomb hits it. Is it supposed to do that? I would like to use this for my lives system, whenever the bombs hit the boomArea (bombBoom is now true. False is when the bomb is in the air falling down.)
Just fixed it as of now. The problem was that boomBoom was being called in the act method of boomArea.
Rotation of my bullet
By Sam123123, with 1 reply.
Replied to by danpost, over 7 years ago:
Sam123123 wrote...
I added bullet code to my character but I don't know how to make my character shoot in the direction of which my character is facing. I have tried about anything on the internet but nothing seems to work. << Code Omitted >>
The rotation of your
Soldaat
actor never changes;, so
getRotation()
will always return zero at line 32.
Bullet
on line 32 is a
Class
I need help for school ASAP
By BilalSLSS, with 1 reply.
Replied to by danpost, over 7 years ago:
BilalSLSS wrote...
I need help in my homework which is to: Create a Chicken and make it fly left and right by changing the argument to the fly(int) method. 2. Create a Chicken and modify its name by invoking the setName(String) method. Put double quotations around the argument. << Code Omitted >>
What have you tried?
Wombats
By baseball2244, with 1 reply.
Replied to by danpost, over 7 years ago:
baseball2244 wrote...
Is it possible for the wombats to move diagonally? << Code Omitted >>
You would need to change line 48 to: <Code Omitted>and add the appropriate cases to the
switch
block in the
canMove
method. However, once an edge is reached, it will turn twice to go along each edge, anyway. Maybe adding a random turn to the code would help: <Code Omitted>
Help on background music!
By SniperRocks, with 6 replies.
Last reply by SniperRocks, over 7 years ago:
ive got a plan so hopefully itll work, ill give an update tomorrow evening.
Variable from MyWorld
By JPEG, with 3 replies.
Last reply by danpost, over 7 years ago:
JPEG wrote...
I'm not sure how, but I treat my actors like Variables. ... how do I figure out what case random has been assigned to? e.g If random followed case 2 (as I already said that the actor paper has to be pressed), the IF statement will mean that scissor's actor will be removed.
Place your actors in an array field: <Code Omitted>They will each now have a number associated with them: <Code Omitted>Your act method can then start wit
Variable Passing
By northernlights176, with 17 replies.
Last reply by danpost, over 7 years ago:
northernlights176 wrote...
You meant the GameScene and not the TitleScreen right? << Code Omitted >>
Yeah. I wanted to see what it does for its extensions. It is not a cause of your current concern; however, I do not really see a need for the class (it actually creates and plays multiple instances of the bg music -- one for each time an object is created for it or any of its extensions). Let us start afresh -- back to your originally posted code (w/o any of the changes I previously suggested) and think about this logically. You start with a
TitleScreen
object. Fine -- let
Enemy Collision
By iminblue, with 5 replies.
Last reply by danpost, over 7 years ago:
iminblue wrote...
They end up in a traffic jam that's the problem .
Well, they will be either on top of each other (fully or partially) or not. You cannot have it any other way.
Random Function
By JPEG, with 2 replies.
Last reply by JPEG, over 7 years ago:
Thanks, it worked!
get backgroound of an Actor
By xandreas_1, with 27 replies.
Last reply by xandreas_1, over 7 years ago:
thx a lot :D
Smooth movements
By aexelmaexel, with 1 reply.
Replied to by danpost, over 7 years ago:
This: <Code Omitted>from the
nachrechts
method, is equivalent to this: <Code Omitted>A similar thing can be said for the loop in the
nachlinks
method. Instead of Position values of 0 and 1, it would be better to have Direction values of 1 and -1. Also, instead of a constant verschiebung value, you can have it decremented to zero during a move (setting it to 88 when a move is initiated). The multiple similar if statements can also be simplified. You woul
Greenfoot crashes as soon as I go onto one of my own projects
By Digital_rookie4, with 9 replies.
Last reply by Digital_rookie4, over 7 years ago:
Its fine now I have found an older but more awkward version that does work
Random Function
By JPEG, with 2 replies.
Last reply by JPEG, over 7 years ago:
Sorry, that's not what I'm asking :)
Using a variable defined in a World class in an Actor Class
By oltmanac, with 6 replies.
Last reply by oltmanac, over 7 years ago:
Thank you so much! Everything works now! I really appreciate you taking the time to help me.
How to use mousePressed?
By Fargesia, with 1 reply.
Replied to by danpost, over 7 years ago:
Fargesia wrote...
I don't understand how to use the Greenfoot.mousePressed command. Like what do I have to put in the brackets? I know that I have to put the object but how do I write it?
The Greenfoot class documentation says this:
Parameters: obj - Typically one of Actor, World or null
Most of the time, it will be '
null
', meaning any click anywhere, or '
this
', referring to the object, created from that class or one of its subclasses, that the current block of code is being executed on (or for). If not one of those, it will be a named reference to an
213
214
215
216
217
218
219
X