資源簡(jiǎn)介
這是一款休閑類(lèi)小游戲,是我們做的自己根據(jù)網(wǎng)上的創(chuàng)意,完全靠自己制作模型,自己原創(chuàng)所做!
代碼片段和文件信息
package?cn.lanpengfei.plane;
import?java.awt.Color;
import?java.awt.Graphics;
import?java.awt.Image;
import?java.awt.Rectangle;
import?cn.lanpengfei.util.Constant;
public?class?Bullet?extends?Gameobject{
double?degree;
public?void?draw(Graphics?g){
Color?c?=?g.getColor();
g.setColor(Color.YELLOW);
g.fillOval((int)x?(int)y?width?height);
x?+=?speed*Math.cos(degree);
y?+=?speed*Math.sin(degree);
speed?+=?0.000008;
if(y>Constant.GAME_HEIGHT-height||y<85){
degree?=?-degree;
}
if(x<10||x>Constant.GAME_WIDTH-width){
degree?=?Math.PI?-?degree;
}
g.setColor(c);
}
public?Bullet()?{
this.degree?=?Math.random()*Math.PI*2;
this.x?=?Constant.GAME_WIDTH/2;
this.y?=?Constant.GAME_HEIGHT/2+20;
this.width?=?10;
this.height?=?10;
//?TODO?自動(dòng)生成的構(gòu)造函數(shù)存根
}
}
評(píng)論
共有 條評(píng)論