rendered paste bodyimport java.lang.Math;import java.lang.*;import java.awt.*;import java.awt.event.*;import java.util.*;import java.applet.*;import javax.swing.*;import javax.swing.event.*; import java.io.File;import java.applet.Applet;import java.applet.AudioClip;import java.net.URL;import javax.imageio.ImageIO;public class ruckel extends JFrame implements MouseMotionListener{ int xx[] = new int[4]; int yy[] = new int[4]; Color bg = new Color(128,128,128); static int screenx = 1024; static int screeny = 740; double grad[] = new double[4]; Image bild[] = new Image[4]; Image gott; boolean gogo = true; int framecount = 0; long oldtime; long newtime; int mx; int my; //thread sachen boolean running; int schlaf = 20; //fur double buffering private Image dbImage; private Graphics dbg; public static void main(String[] args) { ruckel fenster = new ruckel(); fenster.setVisible(true); //fenster.start(); } public ruckel() { setTitle("ruckel"); setBackground(bg); addMouseMotionListener(this); addWindowListener( new WindowAdapter() { public void windowClosing ( WindowEvent e) { System.exit(0); } }); //setSize(Toolkit.getDefaultToolkit().getScreenSize()); setSize(screenx,screeny); setLayout(null); Cursor c; c = getToolkit().createCustomCursor(new ImageIcon("").getImage(),new Point(0,0),"Cursor"); setCursor(c); oldtime = System.currentTimeMillis(); bild[0] = load_img("lol.jpg"); bild[1] = load_img("lol.jpg"); bild[2] = load_img("lol.jpg"); bild[3] = load_img("lol.jpg"); gott = load_img("lol.jpg"); xx[0] = 100; xx[1] = 100; xx[2] = 100; xx[3] = 100; yy[0] = 100; yy[1] = 100; yy[2] = 100; yy[3] = 100; grad[0] = 90.0; grad[1] = 90.0; grad[2] = 90.0; grad[3] = 90.0; gameloop(); } public void fpsa() { setTitle("fps: "+framecount); framecount=0; } public void mouseEntered (MouseEvent e) {} public void mouseExited (MouseEvent e){} public void mouseMoved (MouseEvent e) { mx = e.getX(); my = e.getY(); } public void mouseDragged (MouseEvent e) {} public void gameloop() { while(true) { if (newtime-oldtime >= 1000) {fpsa();oldtime=System.currentTimeMillis();} newtime = System.currentTimeMillis(); grad[0]+=0.02; grad[1]-=0.02; grad[2]+=0.02; grad[3]-=0.02; xx[0] = (int)(300+(200*Math.sin(grad[0]))); xx[1] = (int)(300+(200*Math.sin(grad[1]))); xx[2] = (int)(300+(200*Math.sin(grad[2]))); xx[3] = (int)(300+(200*Math.sin(grad[3]))); yy[0] = (int)(200+(200*Math.cos(grad[0]))); yy[1] = (int)(200+(200*Math.cos(grad[1]))); yy[2] = (int)(200+(200*Math.cos(grad[2]))); yy[3] = (int)(200+(200*Math.cos(grad[3]))); repaint(); try { Thread.sleep(schlaf); } catch (InterruptedException e) { } } } static public Image load_img(String str2) { File f = new File(str2); Image img1 = null; try { img1 = ImageIO.read( f ); } catch (Exception e ) {} return img1; } public void update (Graphics g) { if (dbImage == null) { dbImage = createImage (this.getSize().width, this.getSize().height); dbg = dbImage.getGraphics (); } dbg.setColor (getBackground ()); dbg.fillRect (0, 0, this.getSize().width, this.getSize().height); dbg.setColor (getForeground()); paint (dbg); g.drawImage (dbImage, 0, 0, this); } public void paint(Graphics g) { g.drawImage(gott,mx,my,this); g.drawImage(bild[0],xx[0],yy[0],this); g.drawImage(bild[1],xx[1]+300,yy[1],this); g.drawImage(bild[2],xx[2],yy[2]+300,this); g.drawImage(bild[3],xx[3]+300,yy[3]+300,this); framecount++; }}