i am quitte new to java and greenfoot so i dont know to fix the error i am getting.
i am getting the error in class "Fighter_Kogel" at line 9. This is a subclass of "Kogel"
error:
constructor Kogel in class Kogel cannot be applied to given types;
trquired: int
found: no arguments
reason: actual and formal arguments lists differ in length
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Fighter_Kogel here. * * @author (your name) * @version (a version number or a date) */ public class Fighter_Kogel extends Kogel { /** * Act - do whatever the Fighter_Kogel wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Kogel here. * * @author (your name) * @version (a version number or a date) */ public class Kogel extends beweeg { private Speler speler; private int kogelSnelheid = 5 ; private int richting; /** * Act - do whatever the Kogel wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { geschoten(); move(kogelSnelheid); } /* public Kogel(Speler speler) { this.speler = speler; } */ public void geschoten() { int ypos = getY(); int xpos = getX(); if (ypos < 5 || xpos < 5 || ypos > 763 || xpos > 1361 ){ getWorld().removeObject( this ); } } public Kogel( int rot) { setRotation(rot); if (rot > 0 && rot < 90 ) { setRotation( 0 ); } if (rot > 90 && rot < 180 ) { setRotation( 90 ); } if (rot > 180 && rot < 270 ) { setRotation( 180 ); } if (rot > 270 && rot < 360 ) { setRotation( 270 ); } } } |