Whats wrong with my Constructor? Hello, i got a Problem.
I got two classes, one is the Archer:
And the Arrow
But now, when i compile it, it gives me the Problem
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Schwertkämpfer_2 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bogenschütze extends Player1
{
/**
* Act - do whatever the Schwertkämpfer_2 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int maxzugB;
private int x1;
private int y1;
private int schussmodus = 0;
public void act()
{
if(welcherSpieler()==1)
{
if(zug()==maxzugB)
{
move(8);
getPosition();
schussmodus = 1;
while (schussmodus == 1) {
getSchussmodus();
}
}
}
}
public Bogenschütze(int zug1B) {
maxzugB = zug1B;
}
public void getPosition() {
x1=getX();
y1=getY();
}
public int getSchussmodus() {
return schussmodus;
}
public int getXBogen() {
return x1;
}
public int getYBogen() {
return y1;
}
public void setSchussmodus(int pSchussmodus) {
schussmodus = pSchussmodus;
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class PfeilP1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class PfeilP1 extends Bogenschütze
{
/**
* Act - do whatever the PfeilP1 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private int maxzugB;
public void act()
{
if(welcherSpieler()==1) {
if(getSchussmodus()==1) {
shoot();
}
}
}
public void shoot() {
while(getSchussmodus() == 1) {
if(Greenfoot.isKeyDown("right"))
{
PfeilP1 PP1Rechts = new PfeilP1();
getWorld().addObject(PP1Rechts,getXBogen(),getYBogen());
for(int i=6; i >= 0; i--){
setLocation(getX()+1, getY());
Greenfoot.delay(10);
}
setSchussmodus(0);
zugende();
}
if(Greenfoot.isKeyDown("left"))
{
PfeilP1 PP1Links = new PfeilP1();
getWorld().addObject(PP1Links,getXBogen(),getYBogen());
for(int i=6; i >= 0; i--){
setLocation(getX()-1, getY());
Greenfoot.delay(10);
}
setSchussmodus(0);
zugende();
}
if(Greenfoot.isKeyDown("up"))
{
PfeilP1 PP1Hoch = new PfeilP1();
getWorld().addObject(PP1Hoch,getXBogen(),getYBogen());
for(int i=6; i >= 0; i--){
setLocation(getX(), getY()-1);
Greenfoot.delay(10);
}
setSchussmodus(0);
zugende();
}
if(Greenfoot.isKeyDown("down"))
{
PfeilP1 PP1Runter = new PfeilP1();
getWorld().addObject(PP1Runter,getXBogen(),getYBogen());
for(int i=6; i >= 0; i--){
setLocation(getX(), getY()+1);
Greenfoot.delay(10);
}
setSchussmodus(0);
zugende();
}
}
}
public PfeilP1() {
}
}
Constructor Bogenschütze in class Bogenschütze cannot be applied to given types;
required: Int; found: no arguments; Actual and formal argument list differ in length.
If i now when i put a parameter in when i create a new PfeilP1, it gives me the same answer with "Required: No arguments; found: int;" or something like that.
What am i doing wrong?

