软件工程 小游戏Demo


这是一款休闲类小游戏,是我们做的自己根据网上的创意,完全靠自己制作模型,自己原创所做!
资源截图
代码片段和文件信息
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 自动生成的构造函数存根
}

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)