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
Problem with setImage text style
By Roshan123, with 5 replies.
Last reply by Roshan123, over 4 years ago:
Got it! Thanks
How to use an actor dependency only when the needed actor is there
By Courier_, with 3 replies.
Last reply by danpost, over 4 years ago:
Courier_ wrote...
Thanks! that worked how I needed it to
That is because an element is not trying to be extracted from a list without any elements. A test is done to the list to ensure an element exists in the list before extracting the element.
I need help with my game. It doesn't set the current state to the new state. It allows the user to keep pressing "y"
By Cole, with 4 replies.
Last reply by danpost, over 4 years ago:
The use of "this." seems a bit ... off. Each usage is on a method that is located in the World class, which is the "super" of this class. More appropriate would be to use "super." instead. However. the methods are not over-shadowed by methods with the same names in the MyWorld class, so ... that is why it still works. Greenfoot does not force the use of a subject for method calls. As such, I suggest just dropping all the "this."s from the class. Next, you can remove all objects from the world in one simple call by using "
Actor..class
" instead of calling out all the different typ
DON'T do method if actor does not exist
By NUKES, with 5 replies.
Last reply by danpost, over 4 years ago:
Here is a simplified version of your class:
Add Actors through actor.
By NUKES, with 9 replies.
Last reply by NUKES, over 4 years ago:
danpost wrote...
NUKES wrote...
But that does not do what I want it to do. I have a second actor which is "ball2". 2 of those should be added when bullet touches the actor "Ball". You mentioned using the split method in ball class but the above mentioned split code just creates millions of balls right when I click run.
Sorry. I should have stated that the
split
method should be as
Hippo
wrote it above. Adjust it to create
ball2
objects as required. If still getting millions of
ball2
objects, post entire class codes for review.
I was able to make
Moving World
By PetrusderEchte, with 1 reply.
Replied to by danpost, over 4 years ago:
PetrusderEchte wrote...
My game has a big world. The image goes to the right and left. But when i place my testperson und you walk in one direction, he moves out the image. So my question is, is it possible that the world moves with the charakter?
Please refer to my
Scrolling Tutorial
scenario, which refers to a class that is demonstrated in my
Scroller Class Demos
scenario.
Act() cycles per minute
By m.legere1323, with 2 replies.
Last reply by m.legere1323, over 4 years ago:
Thank you! =)
I have been trying to figure out how to do something like ray casting but I ran into a problem
By Triangluminati, with no replies.
For starters I just started learning to code about 4 or 5 months ago for my school so I'm sorry if I get terminology or something wrong. I have been trying to learn how to code ray casting in Greenfoot so I can apply it to the project I have been working on. I have been following a tutorial somewhat (https://sinepost.wordpress.com/2012/06/16/raycasting/) but I have been trying to come up with my own solutions in areas. I have gotten a useable, but not very playable, version of ray casting to work but the rays have to travel far enough that once they reach an object, the distance between them is so large and the result comes out very blocky/chunky. My main question is if there is a way to shoot out more rays to make the objects appear more smooth or if there is a different approach to reach the same effect. I will add my code here for my player:<Code Omitted>and I will add my world code <Code Omitted>
how do I set an actors rotation to another actors rotation?
By ThatsCrispy, with 2 replies.
Last reply by danpost, over 4 years ago:
Where is the method
drawMaze
(in the
Corridor
class) called from? Show code block.
how do I make it so I only shoot 1 bullet when space is pressed?
By NUKES, with 2 replies.
Last reply by NUKES, over 4 years ago:
works perfectly, thank you very much!
Object does not get removed when at Edge.
By NUKES, with 2 replies.
Last reply by NUKES, over 4 years ago:
danpost wrote...
NUKES wrote...
This might just be a stupid mistake by me, but I cant for the love of god figure out why it does not work. In the following code, I made it so, if my "Bullet" object, touches either the Edge or the "Ball" class, it should get removed, but for some reason it just stays?
Is the
remove
method being called from anywhere? If so, from where? If not, then why not?
As I thought im just Stupid lol. I had to call the remove method. works now, thanks.
Lamda expression and double colon operator
By Roshan123, with 5 replies.
Last reply by RcCookie, over 4 years ago:
Roshan123 wrote...
Thanks a lot to both of you @RcCookie can it be also written as <Code Omitted> ?
No, because Button is not the interface with one method. But you could write <Code Omitted>
laser collision detection not removing the laser when a hit is detected
By roonie01, with 1 reply.
Replied to by Spock47, over 4 years ago:
Can some one plz give me code to make a score counter according to how much seconds the actor is alive
By apcode, with 1 reply.
Replied to by danpost, over 4 years ago:
apcode wrote...
make a score counter according to how much seconds the actor is alive
In class of actor: <Code Omitted>
WHY WONT BY WORLD BUILD
By Damste22, with 1 reply.
Replied to by danpost, over 4 years ago:
Damste22 wrote...
the program's not creating my world
<Code Omitted>and <Code Omitted>The iterators,
i
, remain at zero (no increments given). So, it is stuck in a loop.
World
object never completes initializing. In fact,
Key
objects are created for the first white key multiple times, repeatedly, until memory runs out, whereby you will get a
OutOfMemoryException
.
47
48
49
50
51
52
53
X