import java.awt.*; class Spelare extends Synliga{ private final static int STEG=5, STORLEK=18; private int liv=5, steg=600; private Spelplan plan; private SpelFrame hela; //private string pryl; 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.blue); 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){ liv+=okning; hela.setPoang(liv); } public void getGrej(String str){ hela.append(str); } public int getPoang(){ return liv; } public int getSteg(){ return steg; } }