资源简介
局域网坦克大战源码(Java版)
qq :839160526

代码片段和文件信息
package wyf.cgq;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
public class Bullet
{
private int id;//子弹的id号,该号唯一标志一个子弹
private int tank_id;//该子弹所属坦克的Id号
private int style;//子弹类型,0表示是敌人的坦克发出的,1表示是玩家坦克发出的
private int direction;//代表方法1、2、3、4分别表示上、下、左、右
private int speed;//子弹的运行速度,
private int power;//子弹的杀伤力,即可以使对方掉多少血
private int bullet_x;//子弹所在矩形的左上角的X坐标
private int bullet_y;//子弹所在矩形的左上角的Y坐标
private boolean live=true;//子弹是否存活的状态
public Bullet(){}//无参构造器
public Bullet(int idint bullet_xint bullet_y){//构造器,用于客户端用
this.id=id;
this.bullet_y=bullet_y;
this.bullet_x=bullet_x;
}
public Bullet(int idint tank_idint styleint directionint speedint power
int bullet_xint bullet_y){//构造器,用于服务器端用
this.id=id;this.tank_id=tank_id;
this.style=style;this.direction=direction;
this.speed=speed;this.power=power;
this.bullet_x=bullet_x;this.bullet_y=bullet_y;
}
public void move(){//子弹运行的方法
if(direction==1){this.bullet_y-=speed;}//向上运行
else if(direction==2){this.bullet_y+=speed;}//向下运行
else if(direction==3){this.bullet_x-=speed;}//向左运行
else if(direction==4){this.bullet_x+=speed;}//向下运行
}
public int getId(){return this.id;}//获得子弹的id号
public int getTank_id(){return this.tank_id;}//获得子弹所属坦克的id号
public int getstyle(){return this.style;}//获得子弹的类型
public int getDirection(){return this.direction;}//获得子弹的方向
public int getPower(){return this.power;}//获得子弹的杀伤力
public int getX(){return this.bullet_x;}//获得子弹的X坐标
public void setX(int x){this.bullet_x=x;}//设置子弹的X坐标
public int getY(){return this.bullet_y;}//获得子弹的Y坐标
public void setY(int y){this.bullet_y=y;}//设置子弹的Y坐标
public void drawBullet(Graphics g){//绘制子弹的方法
Color c=g.getColor();//获得画笔的颜色
g.setColor(Color.BLACK);//设置画笔颜色为黑色
g.fillOval(bullet_xbullet_y1010);//绘制子弹
g.setColor(c);//还原画笔的颜色
}
public Rectangle getRec(){//获得子弹所在的矩形
return new Rectangle(bullet_xbullet_y1010);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 76 2008-09-13 11:32 chap09\build\Client.bat
文件 1045 2008-07-18 10:30 chap09\build\ico.gif
文件 76 2008-09-13 11:32 chap09\build\Server.bat
文件 1799 2008-08-08 10:59 chap09\build\wyf\cgq\Bullet.class
文件 3369 2008-08-10 11:52 chap09\build\wyf\cgq\ClientAgentThread.class
文件 6443 2008-08-12 15:42 chap09\build\wyf\cgq\ClientWar.class
文件 598 2008-08-09 10:01 chap09\build\wyf\cgq\CPaintThread.class
文件 596 2008-08-09 09:26 chap09\build\wyf\cgq\PaintThread.class
文件 2751 2008-08-10 12:16 chap09\build\wyf\cgq\ServerAgentThread.class
文件 1162 2008-08-13 09:46 chap09\build\wyf\cgq\ServerThread.class
文件 8692 2008-08-12 15:42 chap09\build\wyf\cgq\ServerWar.class
文件 4150 2008-08-12 20:23 chap09\build\wyf\cgq\Tank.class
文件 1041 2008-08-12 20:34 chap09\build\wyf\cgq\TankClient$1.class
文件 5760 2008-08-12 20:34 chap09\build\wyf\cgq\TankClient.class
文件 1160 2008-08-13 09:46 chap09\build\wyf\cgq\TankServer$1.class
文件 5774 2008-08-13 09:46 chap09\build\wyf\cgq\TankServer.class
文件 1255 2008-08-08 11:25 chap09\build\wyf\cgq\WarMap.class
文件 1045 2008-07-18 10:30 chap09\res\ico.gif
文件 2318 2008-08-08 10:01 chap09\src\wyf\cgq\Bullet.java
文件 4012 2008-08-10 11:52 chap09\src\wyf\cgq\ClientAgentThread.java
文件 8186 2008-08-12 15:42 chap09\src\wyf\cgq\ClientWar.java
文件 431 2008-08-09 10:01 chap09\src\wyf\cgq\CPaintThread.java
文件 441 2008-08-09 09:26 chap09\src\wyf\cgq\PaintThread.java
文件 2538 2008-08-10 12:16 chap09\src\wyf\cgq\ServerAgentThread.java
文件 1226 2008-08-13 09:46 chap09\src\wyf\cgq\ServerThread.java
文件 13362 2008-08-12 15:42 chap09\src\wyf\cgq\ServerWar.java
文件 5764 2008-08-12 20:34 chap09\src\wyf\cgq\Tank.java
文件 6486 2008-08-12 20:34 chap09\src\wyf\cgq\TankClient.java
文件 6550 2008-08-13 09:46 chap09\src\wyf\cgq\TankServer.java
文件 1312 2008-08-12 20:34 chap09\src\wyf\cgq\WarMap.java
............此处省略11个文件信息
- 上一篇:java加数据库的网吧管理系统
- 下一篇:javaxmail jar包
相关资源
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
- [免费]java实现有障碍物的贪吃蛇游戏
- java Servlet投票实例
评论
共有 条评论