F
Freak
Gast
ich find das problem nicht fehler is im titel angegeben.
zeile 11
ist ein tutorial hier aus den forum sehr schön gemacht auch wenn immer wieder der import fehlt und ich keine IDE benutz.
hat jemand ne idee ?
thx by Freak[/code]
zeile 11
Code:
import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Graphics;
import java.io.*;
public class Sprite extends Rectangle2D.Double implements Drawable, Moveable
{
long delay;
long animation = 0;
protected double dx;
protected double dy;
SpielFenster parent;
BufferedImage[] pics;
int currentpic = 0;
public Sprite (BufferedImage[] i, double x, double y, long delay, SpielFenster p)
{
pics = i;
this.x = x;
this.y = y;
this.delay = delay;
this.width = pics[0].getWidth();
this.height = pics[0].getHeight();
parent = p;
}
public void drawObjects(Graphics g)
{
g.drawImage(pics[currentpic],(int) x,(int) y,null);
}
public void doLogics(long delta)
{
animation += (delta/1000000);
if (animation>delay)
{
animation = 0;
computeAnimation();
}
}
private void computeAnimation()
{
currentpic++;
if(currentpic >= pics.length)
{
currentpic = 0;
}
}
public void move(long delta)
{
if(dx!=0)
{
x += dx*(delta/1e9);
}
if(dy!=0)
{
y += dy*(delta/1e9);
}
}
public void setVerticalSpeed(double d)
{
dy = d;
}
public void setHorizontalSpeed(double d)
{
dx = d;
}
public double setVerticalSpeed()
{
return dy;
}
public double setHorizontalSpeed()
{
return dx;
}
}
Code:
public interface Moveable
{
public void doLogic(long delta);
public void move(long delta);
}
ist ein tutorial hier aus den forum sehr schön gemacht auch wenn immer wieder der import fehlt und ich keine IDE benutz.
hat jemand ne idee ?
thx by Freak[/code]