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
i got a code that makes it animate but i already got the mirrord images but how to code it in that when i go left that image player_0 shows instead of player 0 and olso whit 0 1 2 3 4 5
By bonamin, with 1 reply.
Replied to by danpost, 11 months ago:
bonamin wrote...
i got a code that makes it animate but i already got the mirrord images but how to code it in that when i go left that image player_0 shows instead of player 0 and olso whit 0 1 2 3 4 5 << Code Omitted >>
You have yet to initialize the second set of images.
slow down the walking animation
By Tenn0, with 1 reply.
Replied to by danpost, 11 months ago:
Tenn0 wrote...
i dont know how to slow down the walking animation of my "Player" character << Code Omitted >>
You cannot slow the animation by delaying the initializing of the animation images. You will need an extra counter to count act steps between image changes. You will also need to keep track of the last direction moved so this new counter can be set properly to change the image immediately when the direction does change. First, however, you should note that with your current code, some unwanted behavior will occur. Imagine, if both "a" and "left" are down, the speed double
Help identifying another objects image
By Player2IsHere, with 2 replies.
Last reply by Player2IsHere, 12 months ago:
Thanks!
help inverting a players movement keys
By Lonelyf60, with 2 replies.
Last reply by danpost, 12 months ago:
Lonelyf60 wrote...
i figured out how to invert the movement but now the player moves WAY too fast while inverted
Inverting should not change the speed -- it should change the direction:
Making a Asteroids Game (help needed, 2).
By yesineedhelp, with 1 reply.
Replied to by danpost, 12 months ago:
yesineedhelp wrote...
if "a" is pressed, it creates ForceField; however, it does not follow the Rocket. I know for sure I have to use getX() and getY(), but I'm not sure where to put it.
Since the
ForceField
objects created belong to the
Rocket
objects that create them, maybe the
ForceField
class should be inside the
Rocket
class. Either way, the
ForceField
object created by a
Rocket
object should be referenced in the
Rocket
class and controlled by the
Rocket
object it belongs to.
Another problem is then how long the Roc
Parallax Scrolling
By kenNXstar, with 3 replies.
Last reply by kenNXstar, 12 months ago:
@danpost I took the setPaintOrder method and ended up putting everything in order. The speed on everything is super choppy. This trying to figure out how that out.
Good afternoon, I have some problem with my code. Stone should disappear when the relocation is equals to 3. But it's triggering an eror. Can you please help me?
By Ondřej, with 5 replies.
Last reply by nccb, 12 months ago:
You're right, danpost, I hadn't spotted that colision can also remove the object.
Hilfe bei der While-Schleife
By Emalylya, with 1 reply.
Replied to by Super_Hippo, 12 months ago:
Ja, Ausrufezeichen werden zur Verneinung eingesetzt.
help having projectiles act how i want
By Lonelyf60, with 1 reply.
Replied to by danpost, 12 months ago:
Lonelyf60 wrote...
i want to have them move a certain range before exploading and i want them to shoot in the direction of the mouse while also having a 30 second delay ty in advance for the help heres my code: << Code Omitted >>
Where does the 30-second delay come in? When does it start? What, if anything, happens during the delay? And what happens when the 30 seconds is up? There are two things about the code provided that should be noted. One is your loose use of the
getWorld
method throughout the class. Once: the line <Code Omitted>
Making a Asteroids Game (help needed).
By yesineedhelp, with 4 replies.
Last reply by yesineedhelp, 12 months ago:
Thank you, it works. I guess I was thinking wrong.
Change the color of a pixel
By Verdreht135, with 3 replies.
Last reply by danpost, 12 months ago:
Verdreht135 wrote...
When i try to put "GreenfootImage image= getImage () into Myworld it says i have to declar a new method.
In a World subclass, you would use: <Code Omitted>
Pls help
By Moremoneymoreproblems, with 4 replies.
Last reply by nccb, 12 months ago:
For general info, as of the recent Greenfoot 3.8.0+, you can use the new Java feature for this kind of code, so that: <Code Omitted> Can be replaced with: <Code Omitted> Essentially, you can put a variable name after the type in "instanceof" and it declares that variable for use within the if. It will have the type that you just checked with the instanceof.
How to keep track of a single int across multiple objects
By Silvermidnight8, with 1 reply.
Replied to by danpost, 12 months ago:
Silvermidnight8 wrote...
How to keep track of a single int across multiple objects
Easiest reply would be to put the
int
in your
World
subclass where it will be accessible to all
Actor
objects in the active world. You could go as far as adding a
getter
and a
setter
method (for that
int
) in that
World
subclass as well.
Trying to get data about an object without a specific name
By Squashyoshi, with 1 reply.
Replied to by danpost, 12 months ago:
Squashyoshi wrote...
I am using arrays to store the players' hands, and I want to be able to click on a card, then click on the pile to play that card and have the array be updated accordingly.
Since the size of a hand is variable, it might (will be) better to use
List
objects instead of Array objects for the hands (plus draw and discard piles). You can use an array for the players themselves (a game will have a set number of players, regardless of what that values might be. The
if
block might be best placed in your
MyWorld
act
method. Or, at least the
Greenfoot Scenarios
By Pupeatpup7, with 2 replies.
Last reply by Pupeatpup7, 12 months ago:
Thanks I figured it out. :)
9
10
11
12
13
14
15
X