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
Powerup!
By Joyfu1, with 10 replies.
Last reply by danpost, over 7 years ago:
Joyfu1 wrote...
It's more like the user gets an option to either increase their speed or health before they battle the final boss. So, if they press s then they would have selected the option to increase their speed.
Where is your code to proceed to the final (boss) battle in your
TestShop
(or
LevelUp
) class?
Looking for help with a project
By ChaosPhantom, with 4 replies.
Last reply by danpost, over 7 years ago:
ChaosPhantom wrote...
Is there a way to upload my whole project to this thread? It's got a bunch of issues lol
Probably the easiest thing to do is to comment out any problem areas in your code until it compiles; then, upload the scenario to this site providing the code (checking the 'Publish source code' box).
Creating Animations for Two Actors
By ButerWarior, with 7 replies.
Last reply by Super_Hippo, over 7 years ago:
If you remove the "startExplosion", the monster will not (or at least should not) explode though, only the spaceship. A line like this does not do anything: <Code Omitted>Maybe it has to be this: <Code Omitted>
Issues with my game
By PatrickTheCoder, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
Why don't you ask your question here?
How to use JOptionPane after using removeTouching?
By marscentric, with 1 reply.
Replied to by nccb, over 7 years ago:
It doesn't have a yes/no option, but in general, Greenfoot.ask() is easier than JOptionPane. In modern versions of Greenfoot there are issues to do with window ordering if you try to use dialogs in your code.
Get clicked image name
By ChaosPhantom, with 3 replies.
Last reply by Super_Hippo, over 7 years ago:
<Code Omitted> Then you have several options. You can check for a click here in this class. Then either send it to somewhere else to check with the list or check it from here. Or you check for the click on this object from somewhere else.
Non static method cannot be referenced from a static context
By jrome, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
"static" can be translated with "belonging to a class". Static variables are shared with all members of the same class. If every object of the same class has its own value for the variable, it can't be static. It is basically the same for methods. Methods can be static when they don't use anything non-static. For example a method like "getX()" is not static, so you can not use "ClassName.getX()". An Actor is in the world and has its X-coordinate. If there are several Actors of this class in the world, each of them wants to move separately. To use a non-static method, you need to call the metho
Prevent overlap of objects
By Çðæyœn, with 26 replies.
Last reply by danpost, over 7 years ago:
Instead of spawning an array of 7 or so asteroids at a time, would it not be easier to just spawn one at a time at regular intervals? That would avoid the mess of having to know when to spawn again.
Spawn Monsters with Timer
By Verglas, with 3 replies.
Last reply by Super_Hippo, over 7 years ago:
Well, the problem is the "while". No matter what
counter
is at the beginning of the act method (1000 at the beginning or 60 every other time), it will be 0 after line 22. And yes, the act method is called around 50-60 times a second when the speed slider is at 50.
Need help with Shooting Direction of my Actor ( Car fight)
By Wellvyre, with 4 replies.
Last reply by Wellvyre, over 7 years ago:
THANK YOU the reference is needed for sth. later on but im glad you helped me there this school project was about to stress me out since i have limited time and i needed that rly fast to keep on going with the rest.
Help with walls
By jrome, with 5 replies.
Last reply by danpost, over 7 years ago:
jrome wrote...
Is there a way to detect what direction the object you are in contact with is from the character?
The character's direction of movement can be used to determine that. If character had moved up (dy < 0) then any obstacle encountered would be above the character.
Zombie game
By Anna_p, with 18 replies.
Last reply by Anna_p, over 7 years ago:
danpost wrote...
Anna_p wrote...
I wanted the zombie to chase the character and it does, except that when the zombie turns around while it moves. I was wondering if you could help me make it walk in a normal way.
Maybe adding the following line at the end of the ZOMBIE1 class act method might help: <Code Omitted>
I am now trying to make the zombies recognize the objects of the world. I thought about using isTouching like I did for the character except that I don't know what to put after the isTouching for the zombie for it to continue moving. I thought you might
Need help with ArrayList
By ChaosPhantom, with 7 replies.
Last reply by danpost, over 7 years ago:
ChaosPhantom wrote...
Alright, thank you! Also, its meant to be <Code Omitted>
Remove the '
+1
'. The last element is indexed one less than the length of the array (since counting starts at zero).
Problems Loading Next Level
By Radical-Shadow, with 3 replies.
Last reply by danpost, over 7 years ago:
Radical-Shadow wrote...
That makes sense. Do you know if there's any way to minimize that lag?
Process the level change in a different method (other than the
act
method). The
act
method is called continuously by greenfoot while the scenario is running; other method are only called when needed.
Changing Ships
By Joyfu1, with 3 replies.
Last reply by danpost, over 7 years ago:
Joyfu1 wrote...
The image is a total single image.
Okay, you can either check the location of the mouse when it is clicked, and act upon it if in one of the specified areas, or you can add "hit-box" actors into the world and check for clicks on them. Now, what exactly do you mean by change the health bar if it was created in greenfoot? and when would you want to do it?
181
182
183
184
185
186
187
X