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
Assigning names
By tRapkIng, with 4 replies.
Last reply by danpost, over 10 years ago:
Actually, lines 3 through 6 are not needed. Each subclass will have something like this, for example: <Code Omitted>Come to think about it, the field is not really needed (as well as the intermediate 'Racer' superclass). You can use the class name to determine the winner: <Code Omitted>Of course, with a 'getter' method for the field in the Racer class Super_Hippo suggested, you would not need but one class for all the racers (the 'Racer' cla
Most simple way for wall
By Gyracks, with 1 reply.
Replied to by danpost, over 10 years ago:
Gyracks wrote...
what would be the most simple way to make sure the walls would stop the car?
Basically, in the movement code of a single act cycle: (1) move (2) check wall intersection (3) if intersects, move back.
Labyrinth: Wall and Actor
By Maryjo, with 1 reply.
Replied to by DogeOverlord, over 10 years ago:
We're going to need to see your code.
Help using the GreenfootSound class
By dogzilla, with 6 replies.
Last reply by danpost, over 10 years ago:
dogzilla wrote...
That is what I expected too, simple and intuitive. The way it stands now its neither simple nor intuitive. Is there a reason to have the volume logarithmic? I'm not sure why they would code it like and want to understand. Also @danpost are you a moderator on here? Seems like every discussion on here is answered by you haha. If so you should know where I can find the the site/forum/posting rules, couldn't find them anywhere.
No -- I am not a moderator here; just an experienced member who likes to help out. There are links below the reply box you could check out. I cou
Create a new Ball when you right-click on an existing Ball
By chrisbsports, with 1 reply.
Replied to by danpost, over 10 years ago:
Create a method that detects a click on the actor and then creates a ball and adds it into the world at a random location. Then add a call to the method in the act method.
prime number divisible by 3
By divinity, with 7 replies.
Last reply by danpost, over 10 years ago:
divinity wrote...
hi danpost that is not working, i tried it and am getting an empty output. nothing is outputting. blank output
Where did you try it? Show the code you used (method and all).
Greenfoot.isKeyDown not working?
By Hunter1471, with 1 reply.
Replied to by danpost, over 10 years ago:
I think the problem comes from your use of the 'Greenfoot.Delay(int)' calls. These calls stop your entire program for about a second each time it is called using '50' as the parameter. I do not think that is what you are wanting. If I am not mistaken, you want to add apples on alternate sides of the world about one apple per second. This would require an iinstance int field to count the act methods between spawnings. You can have it count to 100 and repeat and when it is evenly divisible by 50, then add an apple. Use the quotient (the value of the counter divided by 50) to determine whic
Slow Movement
By MAR, with 1 reply.
Replied to by danpost, over 10 years ago:
What do you really want to slow down? If you want to slow down the animation, use the 'Greenfoot.setSpeed(int)' method; if you want to slow down the movement, you may need to track the speed in more precise measurements than pixels per move (or maybe just adding a delay counter might do the trick for you). It really depends on what variance in speed you will have for the actors and whether it is just one type of actor or all you are referring to.
How do you make an imported counter go up every second?
By luke6728, with 25 replies.
Last reply by danpost, over 10 years ago:
ryguy wrote...
were do you put for the method for currentTimeMillis();
Your act method seems fine as is. You just need to add the one line I gave you after the 'super' call in your constructor.
Method to check if being simulated
By DogeOverlord, with 5 replies.
Last reply by DogeOverlord, over 10 years ago:
smh thank you
I am having a problem with java.lang.NullPointerException
By itavares, with 2 replies.
Last reply by itavares, over 10 years ago:
It worked ! Awesome , thank you so much for the help danpost ! :)
Removing Object - Nothing happens?
By idk1234, with 15 replies.
Last reply by idk1234, over 10 years ago:
The else code doesn't seem to work, I'm trying to get a random number out of 100, a survivor gets removed depending on if the number is above 50 or below 50.
I want my actor to hold a gun
By Amadeus, with 6 replies.
Last reply by danpost, over 10 years ago:
Amadeus wrote...
Yeah that indeed looks like a better way to do it. Gonna put it in my code thank you, the only thing why i didnt do it this way from the start on is, that i am new to programming and this is my first project, so i do not know so many possibilitys yet.
Yeah. Well, it is always best to have whatever action an object type does should go in its class. That is, for example, a player holds a gun and carries it around; so, that part should be programmed in the class of the player. A gun fires a bullet; so that part should be programmed in the class of the gun. The gun coul
Trouble with health deduction
By StoveAteMe, with 1 reply.
Replied to by danpost, over 10 years ago:
The problem is due to the fact that you are using two different collision methods in your Hit method (namely 'getOneObjectAtOffset' and 'isTouching'. The first one is more limited than the second one and will be 'null' for multiple act methods while the other one returns 'true'. So, nothing is removed from the world and health is decreased four times, to zero, on four consecutive act cycles. There is another collision method you could use to fix this. Instead of using the 'getOneObjectAtOffset' method, and since you do not need a reference to any rocket unless you are actually touching o
Game wont end when counter hits 0.
By Bluedino_, with 2 replies.
Last reply by Bluedino_, over 10 years ago:
I found the problem, i had it miss spelled hahaha. Thanks anyway!
475
476
477
478
479
480
481
X