package javatfly; /** * 子弹类:属于飞行物 * @author XXX * */ public class Fire extends FlyObject { int dir; //dir为0 左上角 为1时垂直上飞 为2时右上角飞 /** * 构造方法:初始化子弹 * x,y,dir分别为子弹的x轴,y轴,子弹移动的方向 */ public Fire(int hx,int hy,int dir) { //确定子弹的图片 img= App.getlmg("/img/fire.png"); //确定子弹的大小 w=img.getWidth()/4; h=img.getHeight()/4; //确定子弹的位置(初始位置在英雄机) x=hx; y=hy; this.dir=dir; } //子弹当前移动的方向 /** * 构造方法:初始化子弹 /**单发子弹的方法 public javatfly.Fire(int hx,int hy) { //确定子弹的图片 img=javatfly.App.getlmg("/img/fire.png"); //确定子弹的大小 w=img.getWidth()/4; h=img.getHeight()/4; //确定子弹的位置(初始位置在英雄机) x=hx; y=hy; } */ /** * 子弹移动方法 */ public void move() { //单发 //y-=15; /*子弹变向 */ if(dir==0) { //左上角飞 x-=5; y-=10; }else if(dir==1) { y-=10; }else if(dir==2) { x+=5; y-=10; } } }
最近下载更多
bssheep LV1
2023年12月31日
陈小灏 LV14
2023年12月15日
我的java LV8
2023年12月14日
1061404770 LV3
2022年9月26日
agjbvfhjbg LV6
2022年9月9日
Jasonast LV1
2022年6月12日
testuser1234567 LV24
2022年5月31日
包呼和 LV10
2022年5月11日
wyx065747 LV67
2022年5月7日
rodert LV14
2022年4月29日
最近浏览更多
gzcznb LV8
4月1日
bssheep LV1
2023年12月31日
我的java LV8
2023年12月14日
jkjfdgbkl LV2
2023年11月1日
1766545549 LV1
2022年11月17日
李沛阳 LV1
2022年11月6日
豆子小兔子 LV9
2022年11月3日
微信网友_6191697646571520 LV6
2022年10月28日
1061404770 LV3
2022年9月26日
迷迭香 LV10
2022年9月21日