資源簡介
eclipse運行,你看看有無裝了wtk,附加了項目可以運行,自己看看吧

代碼片段和文件信息
import?javax.microedition.lcdui.Canvas;
import?javax.microedition.lcdui.Image;
import?javax.microedition.lcdui.game.Sprite;
//源碼下載自源碼愛好者_(dá)www.codefans.net
public?class?boss?extends?Sprite?{
int?boss_xboss_y;
static?int?bossHP=180;
byte?type;
static?int?scrw;
static?int?scrh;
int?speed=3;
????static?bullet?blt;?
????static?planeCanvas?canvas;
????int?bosstime;
????static?final?int?bossblacktime?=10;
public?boss(Image?imageint?weightint?heightint?xint?yint?movetype){
super(imageweightheight);
this.type?=?(byte)movetype;
boss_x?=?x;
boss_y?=?y;
setPosition(this.boss_x?this.boss_y);
scrw?=?canvas.screew;
scrh?=?canvas.screeh;
}
public?void?collision1(int?i){
if(canvas.isCollidesWith(?
canvas.boss_at.boss_x?canvas.boss_at.boss_y?
canvas.boss_at.getWidth()?canvas.boss_at.getHeight()
canvas.bullet[i].bullet_x?canvas.bullet[i].bullet_y
blt.img_bullet.getWidth()?blt.img_bullet.getHeight()))
{
canvas.bullet[i].bullet_y?=?canvas.hero_y;
canvas.bullet[i].isvisible?=?false;
canvas.boss_at.bossHP?-=10;
}
}
int?xy;//爆炸坐標(biāo)
public??void?boss_die(int?xint?y){
bosstime++;
this.x?=?x;
this.y?=?y;
canvas.boom.setPosition(this.x?this.y); ??
canvas.boom.paint(canvas.g);
canvas.boom.nextframe();
}
public?void?b_move(){
switch?(type)?{
case?0:
setPosition(boss_x+=speed?boss_y);
if(canvas.boss_at.getX()<10){
speed++;
}
if(canvas.boss_at.getX()>200){
speed--;
}
nextframe();
break;
case?1:
break;
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
???????????????699060????????????????????69
評論
共有 條評論