📄 mysprite.java
字号:
/*
* Copyright 2003, 2004 Symbian Ltd.
* For License terms see http://www.symbian.com/developer/techlib/codelicense.html
*/
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
public class MySprite extends Sprite {
protected final int SLEEP=1000;
protected static final int RAW_FRAMES=13;
protected static final int HELLOWORLD_FRAME=12;
protected static final int SYMBIAN_FRAME=0;
protected boolean direction=false;
public MySprite(Image image, int width, int height) {
super(image,width,height);
}
public void backwards() {
this.getDirection();
this.prevFrame();
}
public void tick() {
this.getDirection();
if(direction) {
this.nextFrame();
}
else {
this.prevFrame();
}
}
public void getDirection() {
if (this.getFrame() == SYMBIAN_FRAME | this.getFrame()== HELLOWORLD_FRAME) {
getDelay();
if(direction) {
direction=false;
}
else {
direction=true;
}
}
}
private void getDelay() {
try {
Thread.sleep(SLEEP);
}
catch(InterruptedException ie) {
System.out.println(ie.toString());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -