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
School project- create a whack a 'pig' game
By Korina, with 14 replies.
Last reply by danpost, almost 12 years ago:
Korina wrote...
Some of the codes I don't understand the functions.
Do you know how to use the class documentation pages? Each class describes, in detail, what each member (field, constructor, or method) does. You can use it to trace from one class to another to find what you need or learn.
HowToKill
By Anne2403, with 5 replies.
Last reply by danpost, almost 12 years ago:
danpost wrote...
Just add a check for touching the player
in the Fire act method
. If touching player, set a new GameOver world active.
I was quite specific in what I said here as far as where the code should go. Also, there is already an 'isTouching' method in the Actor class. Please review its documentation
here
.
Help with slowmotion timer!
By gamer98, with 6 replies.
Last reply by gamer98, almost 12 years ago:
Thank you soo much, it fixed the problem.
Assistance with generating 4 actors in a random order.
By 0890289, with 5 replies.
Last reply by danpost, almost 12 years ago:
Your code is equivalent to this: <Code Omitted>Briefly explaining, lines 3 and 7 of your code create loops that iterate through only once (after the first iteration, 'i' is incremented to 1 and the condition fails, causing the loop to terminate.
is storage available?
By Dalvengyr, with 15 replies.
Last reply by Super_Hippo, almost 12 years ago:
NikZ wrote...
You could just ask the player, in the beginning before retrieving data, if their Java supports UserInfo. That way running it with 8 will still work. Of course, then there will be no high scores but at least it works.
That's the same as using 'if (UserInfo.isStorageAvailable())...'. With java 8 on the greenfoot site, it returns false.
Dalvengyr wrote...
Oh, what version is your Java if you don't mind? :)
7.71
I need some guidance on this Crab scenario.
By katebrown672, with 28 replies.
Last reply by sometechyguy01, almost 12 years ago:
ok, thanks
help creating an Endscreen
By DesignerOrb362, with 3 replies.
Last reply by danpost, almost 12 years ago:
danpost wrote...
If there are no more mushrooms in the world when the game is won, you can check for none in the world from your world act method and set a new Youwin world active when the condition is met.
I could not have explained it any more clearly.
Quick Question
By Nnacheta56, with 3 replies.
Last reply by danpost, almost 12 years ago:
Nnacheta56 wrote...
Thanks, do you know Which Greenfoot class method allows you to move an object from one world to another world?
That would be a World instance method -- the 'addObject' method. The method will place an actor in the world whether it is already in a world or not (provided it is not already in the world you are trying to add it into). For example, if you had a Level1 world with an Actor mainActor, you can simply create a new world and add the actor into it: <Code Omitted>L
Help with this game...
By DesignerOrb362, with 4 replies.
Last reply by danpost, almost 12 years ago:
The Explosion class of the lunar lander scenario is quite portable. You only need add the class to your project and create a new Explosion object when needed. You will need the 'explosion.png' image added to your 'images' folder of the scenario as well.
Treasure Hunt
By Mickey09, with 56 replies.
Last reply by inkpenKingpin, almost 12 years ago:
Thanks for the help with this. As someone pretty new to this, the step by step was pretty helpful.
How can i create a order-based scoreb
By DesignerOrb362, with 3 replies.
Last reply by danpost, almost 12 years ago:
Super_Hippo wrote...
If you only evaluate the number of laps by the sum of the rotation, then you could turn without driving the track and it is still handled as laps.
Yeah, I had thought about that -- like the vehicle spinning out of control racking up the lap count. I did not think that would be an issue here (though, I could be wrong). Using checkpoints is a good idea, however (just more code to deal with).
One step forward, two steps back algorithm
By inkpenKingpin, with 19 replies.
Last reply by inkpenKingpin, almost 12 years ago:
Thanks
Need help with addObject
By qwerty1, with 9 replies.
Last reply by danpost, almost 12 years ago:
Please read my last post again. I did not say that you cannot code it within an Actor subclass; I said it must be executed on a world object. That does not mean that is must be coded in a World subclass to execute.
getOneObjectAtOffset
By Revan, with 5 replies.
Last reply by danpost, almost 12 years ago:
Revan wrote...
shouldn't those 2 worlds be the same size? super(600, 400, 1); super(6, 4, 10000);
Actually, NO. 'super(600, 400, 1)' would be the same size as 'super(6, 4, 100)'. Cellsize is a 2-dimensional value; that is, the height and width of a single cell will be cellsize pixels long. So, using 'super(w, h, c)' the total size is '(w*c)*(h*c)'. The big difference between a world of 'super(600, 400, 1)' and 'super(6, 4, 100)' is that an actor can be in one of 240000 locations in the first and only in 24 locations in the latter.
How to spawn an item when a world is loaded up
By DesignerOrb362, with 1 reply.
Replied to by Super_Hippo, almost 12 years ago:
Write 'addObject(new ActorName(/* parameters if necessary */), x, y)' and replace x and y with the coordinates. Greenfoot also supports a save world feature to make every actor which you spawned manually will spawn automatically on the same position next time. To do this, right-click on the world background and click the last red line "Save the World". Instead of googling, you can read through the tutorials on this site, they will help you understand how the basics are working.
Tutorial Part 1
628
629
630
631
632
633
634
X