资源简介
用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,软件工程毕设英文文献中英文翻
- java使用后缀表达式实现计算器
- 学生选课管理系统_java_MySQL
- 苏苏爱自由-java扫雷小游戏
- java 串口通信包RXTXComm.jar windows 64位
- Java防篡改方式
- Java单元测试基础
- java web 聊天室 源码
- 多目标进化算法java程序
- Java_Modbus的操作()
- 2019年Java程序设计总复习题库及答案
- commons-dbcp-1.4.jar、commons-pool-1.5.6.jar、
- JSP开发的网络书店以及论文
- java操作微软队列消息(MSMQ)项目源码
- java语言与面向对象程序设计课后习题
- 许愿墙java 源码
- Javaopencv打开窗体显示摄像头
- java课程设计实验报告
- java数学表达式计算程序设计报告
- Java防止xss攻击jar包
- java网上聊天加密系统源代码
- 《Java+Swing图形界面开发与案例详解》
- java-face人脸识别程序代码
- DES+3DES加密算法java代码+图解
- java大作业,实现学生信息增删改查
- 罗马尼亚问题从Arad到Bucharest结果,深
- java平台基于TCP的聊天室设计
- java8.txt
- JavaWeb开发技术课件
- java 选择保存文件的路径
评论
共有 条评论