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
Changing locations of objects after an intersection
By gamer121, with 3 replies.
Last reply by gamer121, over 11 years ago:
So now, I want to add 10 new food objects into the world randomly every time the Player gets to Home. How do I add the food randomly without copy and pasting the code several times? My Food class code is shown below. Thanks so much for the help.
Selecting an actor using Greenfoot.mousePressed(this)
By Zzimon, with no replies.
Trying this again, what I'm trying to do is select an actor after clicking it so that when i have clicked an actor i can press w,a,s or d to get my actor to move either up, down, left or right and after the actor have moved for it to become un-selected again. I have tried this a couple of different ways and haven't been able to get any of them to work, actually if I could just get one tile to move in a direction when i click on it i would be thrilled but I can't. here's a picture of what my world looks like: <Image Omitted> The blue background is made from me using a class that creates a mini-world withing a world so as to get the grid working. I suspect that there is something in my PIP actor or my world actor that is blocking the mousePressed on each of the tile actors and making it click on the PIP element instead and I can't quite figure out which thing in my code that might be causing this. World actor: <Code Omitted>PIP actor: <Code Omitted>and the tile actor with the selection/move script aka my Sword actor <Code Omitted>
Issue with switch
By theiam79, with 4 replies.
Last reply by theiam79, over 11 years ago:
Figured it out. Simple ordering, respawn before removing the old asteroids (duh). What happens when two collide is the picture changes, for effect, a new asteroid respawns 10 pixels in from the left at a random height, and then the two old asteroids disappear.
UserInfo.getTop(10)
By karolis, with 2 replies.
Last reply by davmac, over 11 years ago:
You just need to loop through the users (the list returned by UserInfo.getTop(...)), and print their name and score.
Creating a grid in a non-grid world
By Zzimon, with 89 replies.
Last reply by Zzimon, over 11 years ago:
I don't quite understand what you mean with the Actor field, could you give an example of how to use it?
gif images
By Greenfootnoob, with 1 reply.
Replied to by davmac, over 11 years ago:
Probably you should import the GifImage class and read its documentation.
help with random spawn
By nc-munk, with no replies.
I am making a game for a school project. I need help a random spawn function it is should spawn an asteroid in top for the screen and move down and i cant make them spawn and move my code look in line 27 to 42 <Code Omitted>
Lag in my game
By poon, with no replies.
Hello i'm making a game for my object oriented programming class , i have a world with a scroll based on a project named "Scrolling Man" . that´s the code for the scroll : public void scroll(int cX, int cY) { x = x +cX; y = y +cY; getBackground().drawImage(Background,x, y); } the method is called when an arrow is pressed and it works, but i have a problem. the method makes very slow my game, i tried to reduce the size of the background but that no solves the problem, i removed the method call, and the game have not more lag. Please help me, how can i make the scroll without lag???
Challenge || May 2014 voting
By JetLennit, with 30 replies.
Last reply by JetLennit, over 11 years ago:
This
is where the Challenge page is
HealthBar not losing health.
By Than4tos, with 18 replies.
Last reply by Than4tos, over 11 years ago:
Cheers m8 rly thx alot for the help it's working did not know you could chek it like that hmm nice. just made a quick run through the game and it's working looks like it's done now for the report the boring part. Again thx alot that was the last bit and it was driving me crazy
How do I get my enemy to chase my actor?
By Fang, with 1 reply.
Replied to by danpost, over 11 years ago:
Use the Actor class method 'turnTowards'. You will need to locate the player for that. You can use the Actor class method 'getObjectsInRange' which returns a List object; use the List class method 'isEmpty' with the NOT character ( '!' ) to ensure that at least one element is returned in the list; then, use the List class method 'get' on another instance of the list to get that element from the list and cast that element as an Actor object, saving it in a local variable. With that, you can use the Actor class methods 'getX' and 'getY' to get the location of the actor to use in the 'turnTowa
Storing, retrieving and printing high scores
By karolis, with 4 replies.
Last reply by danpost, over 11 years ago:
There is no way to change the current user while the project is running.
Right placement for Bullet
By kasperk22, with 2 replies.
Last reply by kasperk22, over 11 years ago:
oooh, i see... i think this actually made me realise what double move actually was... thanks
I want to start a new in Greenfoot but it keeps sending me to tutorial.
By Fang, with 4 replies.
Last reply by Fang, over 11 years ago:
Ohhhhhhhhhhhh Thank- you :)
Problem with pointcounter (reference problem)
By kasperk22, with 12 replies.
Last reply by kasperk22, over 11 years ago:
davmac wrote...
I still don't see "shooterpointcounter" ...
yea sorry, i'm a dane and Skydemand is kinda the same as shooter(in danish).. sorry for the mistake
danpost wrote...
Line 75 in your Skydemand class is creating a NEW world object with a NEW pointcounter. This counter is not the same one that your initial world created and will not hold the same value. You need to get a reference to the pointcounter that is already created in the current world. Change line 75 to: <Code Omitted>
oh, i see. yea you are actually right..
692
693
694
695
696
697
698
X