资源简介
一个用java实现的简单地图编辑器,里面的贴图可以自由更换

代码片段和文件信息
import java.awt.Image;
import java.util.ArrayList;
/**
The Animation class manages a series of images (frames) and
the amount of time to display each frame.
*/
public class Animation {
private ArrayListame> frames;
private int currframeIndex;
private long animTime;
private long totalDuration;
/**
Creates a new empty Animation.
*/
public Animation() {
frames = new ArrayListame>();
totalDuration = 0;
start();
}
/**
Adds an image to the animation with the specified
duration (time to display the image).
*/
public synchronized void addframe(Image image
long duration)
{
totalDuration += duration;
frames.add(new Animframe(image totalDuration));
}
/**
Starts this animation over from the beginning.
*/
public synchronized void start() {
animTime = 0;
currframeIndex = 0;
}
/**
Updates this animation‘s current image (frame) if
necessary.
*/
public synchronized void update(long elapsedTime) {
if (frames.size() > 1) {
animTime += elapsedTime;
if (animTime >= totalDuration) {
animTime = animTime % totalDuration;
currframeIndex = 0;
}
while (animTime > getframe(currframeIndex).endTime) {
currframeIndex++;
}
}
}
/**
Gets this Animation‘s current image. Returns null if this
animation has no images.
*/
public synchronized Image getImage() {
if (frames.size() == 0) {
return null;
}
else {
return getframe(currframeIndex).image;
}
}
private Animframe getframe(int i) {
return (Animframe)frames.get(i);
}
private class Animframe {
Image image;
long endTime;
public Animframe(Image image long endTime) {
this.image = image;
this.endTime = endTime;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2011-12-11 20:27 MapEditor\.classpath
文件 385 2011-12-11 20:27 MapEditor\.project
文件 629 2011-12-11 20:27 MapEditor\.settings\org.eclipse.jdt.core.prefs
文件 529 2011-12-23 19:32 MapEditor\bin\Animation$Animfr
文件 1567 2011-12-23 19:32 MapEditor\bin\Animation.class
文件 5396 2011-12-22 21:32 MapEditor\bin\Createfr
文件 1652 2011-12-19 21:41 MapEditor\bin\GameAction.class
文件 8017 2011-12-23 19:34 MapEditor\bin\InputManager.class
文件 8186 2011-12-23 20:22 MapEditor\bin\MapEditor.class
文件 7898 2011-12-23 20:12 MapEditor\bin\MapEditorfr
文件 560 2011-12-23 19:34 MapEditor\bin\Sprite$Route.class
文件 3592 2011-12-23 19:34 MapEditor\bin\Sprite.class
文件 505 2011-12-20 22:37 MapEditor\bin\TileAttribute.class
文件 3751 2011-12-23 19:35 MapEditor\bin\TileMap.class
文件 34443 2009-12-15 09:22 MapEditor\images\fight000_1-1.JPG
文件 777 2011-08-01 08:57 MapEditor\images\godown\103_40.png
文件 757 2011-08-01 08:57 MapEditor\images\godown\103_41.png
文件 749 2011-08-01 08:57 MapEditor\images\godown\103_42.png
文件 777 2011-08-01 08:57 MapEditor\images\godown\103_43.png
文件 752 2011-08-01 08:57 MapEditor\images\godown\103_44.png
文件 742 2011-08-01 08:57 MapEditor\images\godown\103_45.png
文件 740 2011-08-01 08:57 MapEditor\images\godown\103_46.png
文件 763 2011-08-01 08:57 MapEditor\images\godown\103_47.png
文件 807 2011-08-01 08:57 MapEditor\images\goleft\103_56.png
文件 769 2011-08-01 08:57 MapEditor\images\goleft\103_57.png
文件 768 2011-08-01 08:57 MapEditor\images\goleft\103_58.png
文件 780 2011-08-01 08:57 MapEditor\images\goleft\103_59.png
文件 782 2011-08-01 08:57 MapEditor\images\goleft\103_60.png
文件 821 2011-08-01 08:57 MapEditor\images\goleft\103_61.png
文件 784 2011-08-01 08:57 MapEditor\images\goleft\103_62.png
............此处省略66个文件信息
相关资源
- 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投票实例
评论
共有 条评论