资源简介
用Java编写的吃豆人小游戏,操作简单,上下左右控制移动吃豆子,同时会有敌人追赶你,绝对可以运行!!

代码片段和文件信息
package eater;
//class Animation will define the Eater as well as the enemies...be careful with the
//objects passed to the constructors..as unwary external modifination will cause problems..
//Finishing www.codefans.net
//setting size and location of an Animation object will be responsibility of the
//class where this object will be created...
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Animation extends JPanel implements GameConstants {
private int direction;
private int id;
private int velocity;
private int oldDirection;
private boolean changeImage = true;
private ImageIcon icons [];
private int [] imageSequence;
private int currentImage =0;//its value can be 0 to 1 less thatn imageSequence.length
//constructor...
public Animation (ImageIcon [] ic int id int d){
super(null);
setOpaque(false);
icons = ic;
this.id = id;
direction = d;
setSize(25 25);
}//end Constructor..
public int getID (){
return id;
}
public void setVelocity (int v){
if (v>=0 && v<=MAX_VELOCITY)
velocity = v;
}
public int getVelocity (){
return velocity;
}
public void setSequence (int [] newSequence){
imageSequence = newSequence;
}
public int [] getSequence (){
return imageSequence;
}
public void setIcons (ImageIcon [] ic){
icons = ic;
}
public ImageIcon [] getIcons (){
return icons;
}
public void setDirection (int d){
if (direction!=d){
oldDirection = direction;
direction =d;
}
}//end method setDirection..
public int getOldDirection (){
return oldDirection;
}
public int getDirection() {
return direction;
}
public void paintComponent (Graphics g){
super.paintComponent(g);
if (currentImage>=imageSequence.length){
currentImage=0;
}
icons[imageSequence[currentImage]].paintIcon(this g 0 0);
if (changeImage)
++currentImage;
changeImage = !changeImage;
}
}//end class Animation..
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2017-09-05 21:33 eater\.classpath
文件 381 2017-09-05 21:33 eater\.project
文件 598 2017-09-05 21:33 eater\.settings\org.eclipse.jdt.core.prefs
文件 2176 2017-09-05 21:33 eater\bin\eater\Animation.class
文件 1579 2017-09-05 21:33 eater\bin\eater\Background$Dot.class
文件 643 2017-09-05 21:33 eater\bin\eater\Background$Gate.class
文件 13824 2017-09-05 21:33 eater\bin\eater\Background.class
文件 377 2017-09-05 21:33 eater\bin\eater\GameConstants.class
文件 2098 2017-09-05 21:33 eater\bin\eater\GameController.class
文件 3241 2017-09-05 21:33 eater\bin\eater\GameView.class
文件 22 2017-09-05 21:33 eater\bin\eater\Manifest.txt
文件 14378 2017-09-05 21:33 eater\images\Backup_of_eater.cdr
文件 828 2017-09-05 21:33 eater\images\dot.gif
文件 15774 2017-09-05 21:33 eater\images\eater.cdr
文件 1041 2017-09-05 21:33 eater\images\eater_0_1.gif
文件 1067 2017-09-05 21:33 eater\images\eater_0_2.gif
文件 1063 2017-09-05 21:33 eater\images\eater_0_3.gif
文件 1040 2017-09-05 21:33 eater\images\eater_0_4.gif
文件 1057 2017-09-05 21:33 eater\images\eater_0_5.gif
文件 1057 2017-09-05 21:33 eater\images\eater_0_6.gif
文件 1039 2017-09-05 21:33 eater\images\eater_1_1.gif
文件 1062 2017-09-05 21:33 eater\images\eater_1_2.gif
文件 1057 2017-09-05 21:33 eater\images\eater_1_3.gif
文件 1037 2017-09-05 21:33 eater\images\eater_1_4.gif
文件 1067 2017-09-05 21:33 eater\images\eater_1_5.gif
文件 1062 2017-09-05 21:33 eater\images\eater_1_6.gif
文件 1057 2017-09-05 21:33 eater\images\eater_2_1.gif
文件 1081 2017-09-05 21:33 eater\images\eater_2_2.gif
文件 1083 2017-09-05 21:33 eater\images\eater_2_3.gif
文件 1052 2017-09-05 21:33 eater\images\eater_2_4.gif
............此处省略31个文件信息
- 上一篇:java使用后缀表达式实现计算器
- 下一篇:java,软件工程毕设英文文献中英文翻译
相关资源
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- 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论坛 非常详细
评论
共有 条评论