• 大小: 19.48MB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2023-07-14
  • 语言: 其他
  • 标签: Java  小游戏  

资源简介

这是一款休闲类小游戏,是我们做的自己根据网上的创意,完全靠自己制作模型,自己原创所做!

资源截图

代码片段和文件信息

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 自动生成的构造函数存根
}

}

评论

共有 条评论