import java.awt.*; class Spelare extends Synliga{ private final static int steg=5, storlek=18 private int poang=0, steg=0; private Spelplan plan; private SpelFrame hela; public Spelare(int x,int y, Spelplan p, SpelFrame sf){ super(x,y); plan=p; hela=sf; } public void skrivut(Graphics g){ g.setColor(Color.red); g.fillRect(xpos,ypos,storlek,storlek); } public void move(int x,int y){ xpos+=steg*x; ypos+=steg*y; if (xpos<0) xpos=0; if (ypos<0) ypos=0; if (xpos+storlek>plan.getSize().width) xpos-=steg; if (ypos+storlek>plan.getSize().height) ypos-=steg; steg++; hela.setSteg(steg); } public void okapoang(int okning){ poang+=okning; hela.setPoang(poang); } public int getPoang(){ return poang; } public int getSteg(){ return steg; } }