-
大小: 9.87MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-10-05
- 語言: Java
- 標(biāo)簽:
資源簡介
java仙劍奇?zhèn)b傳游戲簡易版。里面包含圖片。記得自己改一下源碼里的圖片路徑。

代碼片段和文件信息
import?java.awt.Color;
import?java.awt.Graphics;
import?java.awt.image.BufferedImage;
import?java.io.File;
import?javax.imageio.ImageIO;
import?javax.swing.Jframe;
import?javax.swing.JPanel;
public?class?Animationframe?extends?JPanel?implements?Runnable{
//阿旺嫂
BufferedImage[]?awsImage?=?new?BufferedImage[17];
int?awsX?=?680?;
int?awsY?=?575?;
int?awsIndex?=?0?;
//旺財(cái)嫂
BufferedImage[]?wcsImage?=?new?BufferedImage[14];
int?wcsX?=?770?;
int?wcsY?=?580?;
int?wcsIndex?=?0?;
//阿朱喂雞
BufferedImage[]?azwjImage?=?new?BufferedImage[6];
int?azwjX?=?736?;
int?azwjY?=?412?;
int?azwjIndex?=?0?;
//母雞坐標(biāo)
BufferedImage[]?mjImage?=?new?BufferedImage[6];
int?mjX?=?756?;
int?mjY?=?480?;
int?mjIndex?=?0;
//小雞坐標(biāo)
BufferedImage[]?xjImage?=?new?BufferedImage[2];
int?xjX?=?712?;
int?xjY?=?512?;
int?xjIndex?=?0;
public?Animationframe(){
try{
for?(int?i?=?0;?i? awsImage[i]?=?ImageIO.read(new?File(“D:/pal/仙劍/阿旺嬸/“+i+“.png“));
}
for?(int?i?=?0;?i? wcsImage[i]?=?ImageIO.read(new?File(“D:/pal/仙劍/旺財(cái)嫂/“+i+“.png“));
}
for?(int?i?=?0;?i? azwjImage[i]?=?ImageIO.read(new?File(“D:/pal/仙劍/阿朱喂雞/“+i+“.png“));
}
for?(int?i?=?0;?i? mjImage[i]?=?ImageIO.read(new?File(“D:/pal/仙劍/母雞/“+i+“.png“));
}
for?(int?i?=?0;?i? xjImage[i]?=?ImageIO.read(new?File(“D:/pal/仙劍/小雞/“+i+“.png“));
}
}catch(Exception?e){
e.printStackTrace();
}
}
public?void?paint(BufferedImage?image?Graphics?frameG?Graphics?imageGint?mapX?int?mapY){
imageG.drawImage(awsImage[awsIndex]?awsX?+?mapX?awsY?+?mapY?null);
imageG.drawImage(wcsImage[wcsIndex]?wcsX?+?mapX?wcsY?+?mapY?null);
imageG.drawImage(azwjImage[azwjIndex]?azwjX?+?mapX?azwjY?+?mapY?null);
imageG.drawImage(mjImage[mjIndex]?mjX?+?mapX?mjY?+?mapY?null);
imageG.drawImage(xjImage[xjIndex]?xjX?+?mapX?xjY?+?mapY?null);
//完成窗體繪制
frameG.drawImage(image?0??0??null?);
}
@Override
public?void?run(){
while?(true){
awsIndex?++;
if?(awsIndex?==?awsImage.length)?{
awsIndex?=?0;
}
wcsIndex?++;
if?(wcsIndex?==?wcsImage.length)?{
wcsIndex?=?0;
}
azwjIndex?++;
if?(azwjIndex?==?azwjImage.length)?{
azwjIndex?=?0;
}
mjIndex?++;
if?(mjIndex?==?mjImage.length)?{
mjIndex?=?0;
}
xjIndex?++;
if?(xjIndex?==?xjImage.length)?{
xjIndex?=?0;
}
try?{
Thread.sleep(130);
}?catch?(InterruptedException?e)?{
e.printStackTrace();
}
}
}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-02?20:06??Game\
?????文件?????????301??2017-07-04?16:22??Game\.classpath
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????文件???????????0??2017-07-04?16:22??Game\.me
?????文件????????1635??2017-07-04?16:22??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-07-04?16:32??Game\.me
?????文件?????????438??2017-07-04?16:22??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-07-04?16:32??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-07-04?16:32??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????文件???????????1??2017-07-04?16:22??Game\.me
?????文件?????????151??2017-07-04?16:22??Game\.me
?????文件???????????1??2017-07-04?16:22??Game\.me
?????文件?????????228??2017-07-04?16:22??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????文件?????????608??2017-07-04?16:22??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????目錄???????????0??2017-11-02?20:05??Game\.me
?????文件??????????42??2017-07-04?16:22??Game\.me
?????文件?????????565??2017-07-04?16:22??Game\.me
?????文件??????????58??2017-07-04?16:22??Game\.me
?????文件??????????73??2017-07-04?16:22??Game\.me
?????文件??????????62??2017-07-04?16:22??Game\.me
?????文件??????????97??2017-07-04?16:22??Game\.me
?????文件?????????148??2017-07-04?16:22??Game\.me
?????文件?????????126??2017-07-04?16:22??Game\.me
............此處省略511個(gè)文件信息
評(píng)論
共有 條評(píng)論