Found it! After about 15 min of trying to get the same error as you, I think I've figured it out.
This SHOULD be whats wrong :
In the 'Gun' class under the " public void act() " in the code :
if(Greenfoot.isKeyDown("space") )
{
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
}
Your :
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
is probably missing the " getRotation() " in the " (new Bullet(getRotation()), getX(), getY()); "
Without the " getRotation() " you get that error message.
Hope this fixes it! :D
I have that but it comes up with the same error, but different, if you are still following. The error message is: constructor Bullet in class Bullet cannot be applied to given types;
required: no arguments; found: int; reason: actual and formal argument lists differ in length
PLEASE HELP!!!!!!!!!!!!!!!!
forteddyt wrote...
Found it! After about 15 min of trying to get the same error as you, I think I've figured it out.
This SHOULD be whats wrong :
In the 'Gun' class under the " public void act() " in the code :
if(Greenfoot.isKeyDown("space") )
{
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
}
Your :
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
is probably missing the " getRotation() " in the " (new Bullet(getRotation()), getX(), getY()); "
Without the " getRotation() " you get that error message.
Hope this fixes it! :D
I have that but it comes up with the same error, but different, if you are still following. The error message is: constructor Bullet in class Bullet cannot be applied to given types;
required: no arguments; found: int; reason: actual and formal argument lists differ in length
PLEASE HELP!!!!!!!!!!!!!!!!
I got the same error by defining the bullet function with a "void" in it. Did you accidentally write void in the function definition?
It should be public Bullet(int dir), not public void Bullet(int dir).
Hello
How do i make the man to shoot out a strawberry?
As previously requested in this discussion thread:
davmac wrote...
< Quote Omitted >
Please open a new thread with details of the problem you're facing instead of reviving this very old discussion thread.
Also, follow the general rules about posing a question within the discussion thread. Show attempted code and explain in detail what you are trying to do and what issue you are having with it.