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 stop a single method from another class
By grnft, with 8 replies.
Last reply by grnft, over 8 years ago:
as long as the protected method works: isProtected = true() killDementor() NOT killHarry() of the Dementor class It has only one life, but this one is protected as long as the timer works. Maybe it would be easier to just give him four lifes as soon as he hit the "Tarnumhang class" but this case doesn't work on another object either. Then I would create a healthbar. See another discussion on greenfoot "my extra life doesn't work".
If-statement: actor has a specific picture?
By elena, with 3 replies.
Last reply by danpost, over 8 years ago:
elena wrote...
How exactly do I "ask" whether the Image is the Image B? << Code Omitted >> So far, I have the code above but <Code Omitted>doesn't work and I don't know what else to use in that line...
GreenfootImage
is class name -- not an image name. Objects created from the class are
GreenfootImage
objects that you can name yourself:
Wall that doesnt let Tank pass
By Mirco420, with 9 replies.
Last reply by danpost, over 8 years ago:
Mirco420 wrote...
Habe noch eine Frage ...
English please -- and if this is a different issue, please start a new discussion thread and show related codes.
How to create objects after a certain period of time
By grnft, with 6 replies.
Last reply by grnft, over 8 years ago:
Of course, it was simple. Thanks for your help anyway.
How to use Wait
By Ticker175, with 11 replies.
Last reply by Ticker175, over 8 years ago:
Ok cool thanks =)
adding the amount of removed objects to my score counter
By grnft, with 2 replies.
Last reply by grnft, over 8 years ago:
You're a genius!
Adding a object at the edge of the screen
By grnft, with 2 replies.
Last reply by grnft, over 8 years ago:
You rescued my project!! Thank you so much!
Help with isAtEdge() method
By Catw24, with 1 reply.
Replied to by danpost, over 8 years ago:
Catw24 wrote...
I wanted that when my actor reaches the edge he should turn and then move forward but he's kind of stuck at the edge. It seems like it doesn't matter if he's facing the edge or not. If any part is next to the edge he'll just keep turning. Is there some way to modify this method
Use dual conditions for turning. Check at edge state and the rotation of the actor to determine whether to turn or not.
Help in Score addition
By kukusls, with 1 reply.
Replied to by danpost, over 8 years ago:
kukusls wrote...
<< Code Omitted >> That is my Score class which should be shown up on the enscreen(called gameover) aktHighscore should be an addition of "sekunden" and "MyWorld.collectablesCount" but it only shows up the MyWorld.collectablesCount Here my scoreboard class: << Code Omitted >> Furthermore, my Collectablescounter does acutally not reset when you press the Reset button in greenfoot and I dunno why Someone can help me?
You need to create a retain a
Highscore
object in your world and add it to the world when game is over (otherwise the start time will be the end
Bullets following my gun
By Mirco420, with 4 replies.
Last reply by danpost, over 8 years ago:
Mirco420 wrote...
I have got turrets which can shoot automatically. They can turn aswell but as soon as they turn, they bullets come out of the centre of the turret and not out of the gun anymore:D
In the Tower class, remove the "-80" from line 33 and insert at line 34 the following: <Code Omitted>Do similarly in the Panzer class, at line 45.
Bug in Shooting
By Vincent199000000, with 3 replies.
Last reply by danpost, over 8 years ago:
Line 19 in the
Kugel
class gets the x- and y-coordinates of the actor -- or, at least it tries to. The line will fail if the actor is not in a world -- and it will not be in a world if the bullet hits a
Rakete
object (by way of the call on line 18 to the
zerstöreDeutschgegner
method. Insert the following at line 19 (after the call): <Code Omitted>You will need to do similarly in the
Hindernis
and
Deutschgegner
classes, as well. The same type situation may also happen in the
Rakete
class; you can use and "else if" in t
Collision Detection From Different Sides
By Vise, with 1 reply.
Replied to by danpost, over 8 years ago:
Vise wrote...
Let's say I have a rectangular block. How would I determine if another actor is touching the top of the block or the bottom of the block or side of the block. Is it possible in greenfoot? If so, what is the general idea to do so and the methods needed for it?
The way I would handle it is by separating horizontal movement from vertical movement and using the direction of movement of each to determine how contact with an obstacle was achieved, allowing for the reversion or proper location setting upon such contact. The idea can be seen in the code of the
Who
class of
Updating my score board
By amazingfish, with 6 replies.
Last reply by amazingfish, over 8 years ago:
Thank you danpost! Love the solution!
Cannot find symbol error
By luc123, with 3 replies.
Last reply by luc123, over 8 years ago:
Thanks you so much
My snake tail won't become a tail, it just sits at a fixed position, any ideas?
By vaal, with 3 replies.
Last reply by danpost, over 8 years ago:
vaal wrote...
sorry my bad im a little weary, this is it << Code Omitted >>
I do not see any movement code for the tails.
248
249
250
251
252
253
254
X