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
Make game stop when car hits wall.
By reportersnotebook, with 1 reply.
Replied to by Super_Hippo, almost 11 years ago:
Add 'canMove();' at the end of the act-method to call the method and 'Greenfoot.stop();' in the method's if-block to stop the sceanario.
Making an actor move as fast as you tap
By 6716070, with 1 reply.
Replied to by danpost, almost 11 years ago:
GamePad Template and Tester Problem
By keizerbob, with no replies.
Trying to load gamePadTemplate or GamePadTester into Greenfoot produces the error that this line 4 import item cannot be found: 4 import net.java.games.input.*; How do I fix this? Also, the Web page link to JInput Project (jinput.dev.java.net) doesn't work. Thanks, Bob
I really need help with my programm something went wrong from one Moment from the other and I have to send it to my teacher today evening can you guys have a look pls?
By AddiFlash, with 4 replies.
Last reply by danpost, almost 11 years ago:
I am sure it will not work like you want without lines 3 through 5 moved to outside the method. As it is, if a mensch does intersect a kranchmacher and does not immediately die, it will never die. This would be due to the fact that the image that will be reference by 'image2' will no longer be the image that was set to the actor as the GreenfootImage objects referenced by the three fields are changed every act method (they may be created from the same file in memory; but, they are still different GreenfootImage instances).
buttons query
By davemib123, with 5 replies.
Last reply by danpost, almost 11 years ago:
You should also be using 'mouseClicked' in place of 'mousePressed' (you should not need the 'buttonPressed' field at all).
How to clear an image?
By sheshank, with 2 replies.
Last reply by sheshank, almost 11 years ago:
Thank you! I had the addObject line but I didn't see the constructor. I thought there was only the act method. Thanks a lot!
Enemies randomly spawning?
By Jnrichards, with 4 replies.
Last reply by danpost, almost 11 years ago:
Jnrichards wrote...
i've only been able to get it to start at a set location, idk how to do the rest private void prepare() { Enemy enemy = new Enemy(); addObject(enemy, 178, 788); }
You can replace the hard-coded int values, '178' and '788' with method calls that return or variables that hold random int values. EDIT: just saw your second post -- looks okay. And yes, it is possible to have the counter add 10 to its value. Show your Counter class code, the code that creates and add one into the world and your attempt at accessing/changing its value.
How to fixt the error in greenfoot ((slodor) look like flappy bird but not)
By walidiah, with 2 replies.
Last reply by walidiah, almost 11 years ago:
okay. thank's 4 ur help :D
boolean method/variable in if-functions?
By wookles, with 1 reply.
Replied to by wookles, almost 11 years ago:
nevermind!
Coordinates
By Student07, with 1 reply.
Replied to by Super_Hippo, almost 11 years ago:
Who is the user? How do you want to save x and y -- where do you need them?
Registering clicks on objects.
By Chapaladeen, with 2 replies.
Last reply by danpost, almost 11 years ago:
Chapaladeen wrote...
Obviously doing something wrong in the last part as it just seems to register a click on anything on the screen as it prints "hi" no matter where I click. I was also wondering whether there is a way I can determine which one of the actors of that type were clicked?
You should probably check the
Greenfoot class documentation
on the 'mouseClicked' method to see how to use it.
Set lifetime of an object
By Ramin, with 10 replies.
Last reply by danpost, almost 11 years ago:
Ramin wrote...
How can I reset the timer? <Code Omitted> like this??
Something like that. You might want to 'eat' the Injection object also.
height of hero from enemy class
By davemib123, with 8 replies.
Last reply by danpost, almost 11 years ago:
davemib123 wrote...
Edit: I've used an offset to check bottom of a block object. how can I check then entire width depending on where my hero hits it?
I just now (2 hours later) noticed the editing of your last post. What I usually do is just check for intersecting of the object from the player class after moving. I use the direction of movement to determine which side of the player makes contact with the intersecting object (btw, that is precisely what I did in my
Jump and Run Demo w/Moving Platform
scenario).
How to create an Array?
By Loled85, with 5 replies.
Last reply by Loled85, almost 11 years ago:
Yeah it was my limited amount of thoughts about that project-I tried the weirdest ways instead of just do the easy obvious way. Anyway just forget about it please ^^'
Scaling an Image
By ironphoenix20, with 1 reply.
Replied to by davemib123, almost 11 years ago:
i usually scale it manually: <Code Omitted> then in the constructor: <Code Omitted>
510
511
512
513
514
515
516
X