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
life or gasoline
By elvacan, with 4 replies.
Last reply by danpost, about 1 month ago:
elvacan wrote...
if you can pass me the code
With the int field: <Code Omitted>It might look something like this: <Code Omitted>
life bar
By elvacan, with 1 reply.
Replied to by RcCookie, about 1 month ago:
There is no general solution to a problem like this. But here is some useful information: If you want to do it the object oriented way, you may create a HealthBar class: <Code Omitted> To create a visual health bar, use GreenfootImage to set the objects image. Here are some important methods:
hi
By truck_hunt97, with 1 reply.
Replied to by Spock47, about 1 month ago:
Here is a source code that slows down all enemies by one movement point for 5 seconds when You collects a SlowDownObject. The SlowDownObject is consumed in the process. <Code Omitted>
achievements
By elvacan, with 14 replies.
Last reply by danpost, about 1 month ago:
RcCookie wrote...
RcCookie wrote...
Should be:
danpost wrote...
spawning actors on top of moving actors
By tedyy, with 2 replies.
Last reply by danpost, about 1 month ago:
The error occurs because
getObjects(Shit.class)
returns a
List
object, not a specific
Actor
object, and
getX()
and
getY()
are only declared in the
Actor
class as instance methods. That is, you cannot use those methods on a
List
instance. You must first make sure that the list is not empty. Then, if not, extract a ship from the list and use the methods on it.
My for clause doesn't work
By Turbo_Thorsten, with 3 replies.
Last reply by danpost, about 1 month ago:
Also, line 3, within a
for
loop, is troublesome because you a scaling the same image multiple times, which never works well. Best is to save the original image in an instance field, and on each iteration of the loop, create a copy of that image and then scale the copy once.
i need held with my code
By truck_hunt97, with 3 replies.
Last reply by danpost, about 1 month ago:
truck_hunt97 wrote...
I have a coin counter, every time I take one, this is the account, how do I multiply its value?
Show all methods and fields that deal with the coin counter and indicate the classes each code block/field is in.
Hi i need held thanks in advance
By truck_hunt97, with 1 reply.
Replied to by Spock47, about 1 month ago:
Please have a look at https://www.greenfoot.org/topics/64967/0 There is a menu to choose which ship the hero is flying. You can reuse it for your idea, especially adding buttons for each position to the chooser-menu. At the button action, you can also add a check whether the hero has enough coins and the reduction of coins when the number of coins is sufficient. You can also add booleans to the hero class to indicate whether the effects are already bought. Please let me know whether this helps, otherwise just add additional questions as response here to resolve any remaining problems.
I need help pls
By OE51, with 2 replies.
Last reply by Spock47, about 1 month ago:
The problem is probably the check "x>=0 ||x==getWorld().getWidth()". The first part checks whether x is greater or equal 0, which is always true. But I think you want to check whether x is less or equal. Note, that you need two simple ideas as the basis for the reflecting: 1. If the fish bounces off top or bottom, its new rotation is 360-oldValue. 2. If the fish bounces off left or right, its new rotation is 180-oldValue. A simple source code to implement this:
I need help with a code!
By ELquenosabena, with 2 replies.
Last reply by ELquenosabena, about 1 month ago:
ok, but, could you send me a code, as an example, if you can
I need help with some code
By nedenatt, with 1 reply.
Replied to by danpost, about 1 month ago:
Use
Actor
type objects to display clickable text. Use
World
objects for different screens (probably).
jump n run please help
By jerno, with 1 reply.
Replied to by danpost, about 1 month ago:
Need codes for
Robby2
constructor and for
randonSpawn
method.
Ball being launched in a certain direction
By Gengar360, with 1 reply.
Replied to by Spock47, about 1 month ago:
It seems that "this.paddle" is null. Therefore: 1. Please give the source code where the constructor is called (new Ball(..., ...)). (if the first parameter is null, we found the problem) 2. Please change the line "public Paddle paddle;" to "private final Paddle paddle;". This ensures that the constructor is the only place "this.paddle" is set (otherwise one would have to check whether paddle gets changed somewhere else in the source code).
Boolean Turning Off by Itself
By LegoAJ, with 1 reply.
Replied to by LegoAJ, about 2 months ago:
Never mind, I figured it out.
Card Matching Game
By vinxl, with 2 replies.
Last reply by vinxl, about 2 months ago:
sorry to say I decided not to submit anything and fail my course. I just lost interest in programming :<
1
2
3
4
5
6
X