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
Casting int to double
By gmacias, with 4 replies.
Last reply by gmacias, over 9 years ago:
now I understand! Thank you.
Basically trying to get a ball to be hit by a shooter and into a goal. Works once, would like to keep score and replace shooter and ball in world. Have two different versions, commented out lots.
By MNastasi, with 1 reply.
Replied to by danpost, over 9 years ago:
Try, instead of removing and replacing the ball with a new one, to just reset the location of the current ball back to (311, 365) using: <Code Omitted>.
Collision issues
By grizzly1, with 5 replies.
Last reply by danpost, over 9 years ago:
grizzly1 wrote...
could u maybe give me a little code on how to fix that, I just can't figure it out myself
danpost wrote...
I think the problem stems from the order that you are doing things. You are increase the speed after moving. If it is intersecting a block, you set the speed back to zero and no movement will occur.
What I said here suggests that you first increment the speed and then move. Switch lines 127 an 128 above.
Programming Best Practice in Animation: Which is better?
By gmacias, with 2 replies.
Last reply by gmacias, over 9 years ago:
Good to know. Thank you for your help! :)
Right key works, but left doesn't Help!
By MNastasi, with 2 replies.
Last reply by danpost, over 9 years ago:
Super_Hippo wrote...
I personally avoid using the getKey-method and use the isKeyDown-method though.
As you should -- the getKey' method is best suited for string input where typing in words or numbers outside of gameplay is required.
changing what an AI actor does each level
By kinghunter, with 1 reply.
Replied to by danpost, over 9 years ago:
kinghunter wrote...
I'm currently making a game in which a spaceman has to avoid the bullets fired by an alien ship and advances to the next level. I'm stumped how do i change what the alien does, specifically rate of fire and direction in my new levels instead of the same thing each time... any help is greatly appreciated
You could do something like this: <Code Omitted>for example. The problem is that you cannot do this until the actor is adde
How to open multiple scenarios from one scenario
By ArchMageGaming, with 1 reply.
Replied to by danpost, over 9 years ago:
ArchMageGaming wrote...
So, me and a friend are working on two games that are very similar. We have created both games but want them to be in one scenario altogether. Is there a way so if we click a button in one scenario, it would open the other one?
The short answer is ... no. Not without having the classes of both of them in one project
counting total employee of a company
By divinity, with 1 reply.
Replied to by danpost, over 9 years ago:
@divinity, I think you know by know that you need to show some effort and that only specific programming issues are dealt with here. We are not here to do the work for you. As you explained your issues above:
how do you count the total number of hourly paid workers, monthly paid workers and commission workers in a company.
The type of objects that represent the workers and how you access them is needed.
how to compute the total figures for all employees netpay, grosspay and deductions
The computations is basic math. And again, "for all employees" requires t
"You Won!" Screen
By jdelia3, with 2 replies.
Last reply by danpost, over 9 years ago:
I think the key word here is "tile". You could change the "You Win" world size (presuming that you are using a world to display it) to that of the image. The other option is to not use the image as the default image and either draw the image onto the background or use an actor to display it.
2D Array Game (cant figure out why my cards wont flip properly)
By mukul2345, with 1 reply.
Replied to by danpost, over 9 years ago:
I am not sure about the difference between 'isCovered' and 'unCovered' -- but I believe one is for whether the card is showing and the other is whether the card is already matched. You need to determine both of these states on 'p' when checking for the current first flipped card.
Getting the score value from my world called MyWorld to my Game Over World
By shivzzz123, with 1 reply.
Replied to by SPower, over 9 years ago:
Because you want to pass it into a different world, you could put it in the constructor of the game over world: <Code Omitted>
Not sure why I am getting a nullPointerException?
By MNastasi, with 5 replies.
Last reply by nikhil_sundaram, over 9 years ago:
danpost wrote...
MNastasi wrote...
Not sure why I am getting a nullPointerException?
What line is the exception being thrown at? Also, show the error trace printed in the terminal window.
This is the nullPointerException that I keep getting for the code java.lang.NullPointerException at Ball.isTouchingGoal(Ball.java:53) at Ball.act(Ball.java:22) at greenfoot.core.Simulation.actActor(Simulation.java:594) at greenfoot.core.Simulation.runOneLoop(Simulation.java:552) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simula
need help with my collision
By grizzly1, with 8 replies.
Last reply by grizzly1, over 9 years ago:
that is what i got so far, the problem is that the if I jump to a block from underneath it the charakter gets stuck in the block does anyone why that happens?
Access to a boolean
By carti26, with 5 replies.
Last reply by danpost, over 9 years ago:
Since there are no 'public' members that the car can call to acquire the boolean value, it is impossible at this time. Either change the access modifier of the boolean field to 'public' (from 'private') or add a 'public boolean getRunning()' method that returns the value of the field so the car can call the method to get the boolean value. Once that is done, the value will be accessible; however, accessing it is yet another step in the process. The line I gave above can be followed by either:
Tracking bullets and replenishing bullets
By n15, with 1 reply.
Replied to by danpost, over 9 years ago:
453
454
455
456
457
458
459
X