当前位置: 技术问答>java相关
如何实现一张图片的平滑移动!!!!谢谢急!!!!
来源: 互联网 发布时间:2017-04-10
本文导语: 如提 | 给你个例子,自己看把 import java.awt.*; public class MoveDemo extends java.applet.Applet implements Runnable{ Image offScreenImg; Graphics offScreenG; MediaTracker tracker; Image walkerImgs[]=new Image[5]; Image cur...
如提
|
给你个例子,自己看把
import java.awt.*;
public class MoveDemo extends java.applet.Applet implements Runnable{
Image offScreenImg;
Graphics offScreenG;
MediaTracker tracker;
Image walkerImgs[]=new Image[5];
Image currentImg;
int xpos,ypos=0;
int walk_step=20;
int delay=250;
Thread runThread;
Image bgImage;
int applet_width,applet_height;
int birdImg_width;
public void init(){
tracker=new MediaTracker (this);
for(int i=0;i
import java.awt.*;
public class MoveDemo extends java.applet.Applet implements Runnable{
Image offScreenImg;
Graphics offScreenG;
MediaTracker tracker;
Image walkerImgs[]=new Image[5];
Image currentImg;
int xpos,ypos=0;
int walk_step=20;
int delay=250;
Thread runThread;
Image bgImage;
int applet_width,applet_height;
int birdImg_width;
public void init(){
tracker=new MediaTracker (this);
for(int i=0;i