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
Generating falling objects randomly on the X axis
By KrystalLo, with 9 replies.
Last reply by KrystalLo, over 9 years ago:
Oh, I got it working! Thank you so much Dan! I'll probably ask more questions a bit later after I do a few more things with the game. Thank you!
Class removed after creating duplicate
By jeffcia, with 1 reply.
Replied to by danpost, over 9 years ago:
The only way the Crab class would show up in the "Other classes" area is if you removed what class it extended or changed it to something other than Actor or World. Just make sure you have the class extending the Actor class. If you have issues with bringing it back, post the code for the class so we might be able to tell what is happening and why it is not showing up where you want it to.
Array Problem
By Rabe123, with 9 replies.
Last reply by Rabe123, over 9 years ago:
Thank you danpost :)
Bullet Hoses
By ZacBuzzsaw, with 3 replies.
Last reply by danpost, over 9 years ago:
@SPower, I see where you see an assignment symbol ( '=' ) in place of a conditional equality symbol ( '==' ); however, it will never actually change the value there as it was just set to 'true' in a previous line. What this means is that the question does need to be asked. Removing lines 9, 10 and 14 will not change what the code does. Also, a timer is not what ZacBuzzsaw is going to need -- a boolean field is indeed what is wanted (like the 'isShot' field), but the way it is used is incorrect (hence, its name is also misleading). The field should track the state of the "space" key or shou
Using getImage().mirrorHorizontally()
By moretinshop, with 2 replies.
Last reply by moretinshop, over 9 years ago:
Thanks for your help, I ended up using a solution similar to the one found in this thread: http://www.greenfoot.org/topics/200 BTW, lines 11-15 do not work without a method, the linked thread uses a for loop to do something similar.
stopGame problem
By smcgee, with 10 replies.
Last reply by smcgee, over 9 years ago:
I appreciate that - you do great work and so many benefit from your contribution to teaching future programmers.
Why wont this make a triangle?
By flash007, with 1 reply.
Replied to by danpost, over 9 years ago:
For one thing, once the method has completed its execution, the 'bg' variable is lost. By creating a
new
GreenfootImage object, you are not dealing with the image returned by the use of 'getBackground'. but making a copy of the background image.
Problem with Space Invaders!
By Yvonne, with 4 replies.
Last reply by danpost, over 9 years ago:
Yvonne wrote...
I am not sure why the Aliens are not shooting. Is the code wrong?
The 'shoot' method in the Alien class is not being called at all. You should probably have it called from the act method under some random condition.
World not being constructed, no zero-argument constructor available?
By moretinshop, with 2 replies.
Last reply by moretinshop, over 9 years ago:
My hero <3
Delay method creating problems with objects moving after spawning
By CrimsonGuitarist, with 3 replies.
Last reply by danpost, over 9 years ago:
@SPower, if it is done the way you suggest, there will have to be a way to determine beforehand which note is to be added when one is to be added. That means the a representation of the order of notes and the wait time between them must be listed in a string or with the use of one or more arrays or lists. My suggestion for this is to use a song string that has letters for the notes and numbers for the times. The numbers can be reduced to one digit numbers by dividing the wait time by a common factor (in the code given by CrimsonGuitarist, that factor would be 25). Then the playSong code wo
How do I close one world and open another?
By senga9872, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
It could be like this in the start screen act method: <Code Omitted>
How can I stop a counter from counting once it has reached a certain number?
By Sonarwave, with 6 replies.
Last reply by Sonarwave, over 9 years ago:
Hey guys, I'm sorry to say that the code here didn't work :( but on the bright side, a friend of mine helped out and it is all fixed. thanks for everyone's efforts in helping :D
Pacman Game
By JayHawk, with 5 replies.
Last reply by danpost, over 9 years ago:
JayHawk wrote...
now how do i get a actor to randomly move?
For a pacman ghost, you would do something like this: (1) turn to face current direction moving (2) move (3) determine and list possible directions to proceed from new location (4) randomly choose a direction from the list (5) set possibly new current direction to move as determined by random choice in (4) (6) reset rotation back to zero
How to apply gravity and air resistance?
By Michael1000, with 10 replies.
Last reply by danpost, over 9 years ago:
I have written a support class for smooth movement and rotation that has a subclass to apply gravity and drag (air-resistance). They are both included in my
GQActor Superclass Demo
scenario.
How to make text appear and conter
By prifkin, with 2 replies.
Last reply by danpost, over 9 years ago:
prifkin wrote...
I need a way so when the if statement executes, I can make a line appear that says"Press space to respawn". Also, how can I make a counter that every time I collect a certain object, the counter goes up. This should be a visible counter.
These are both a matter of displaying values (one is an integer value and the other is a string value). You could check out my
Value Display Tutorial
to see how this can be done.
459
460
461
462
463
464
465
X