资源简介
基于java的连连看游戏设计和实现,基本功能包括:消除模块,重新开始模块,刷新模块,选择难度模块,计时模块。本系统结构如下:
(1)消除模块:
完成连连看游戏消除动作的模块。
(2)重新开始模块:
完成连连看游戏中重新开始新一局游戏功能的模块。
(3)刷新模块:
完成连连看游戏中,将游戏中未消除的图片个数记录并重新随机放置等数量图片的功能模块。
(4)选择难度模块:
完成游戏中切换游戏难度并开始新一局游戏的模块。
(5)计时模块:
完成游戏中倒计时并显示提示信息的模块。
(6)状态显示模块:
完成游戏中对游戏得分、闯关数记录的模块。
代码片段和文件信息
import java.awt.Choice;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class LianLianKan extends Jframe {
private static final long serialVersionUID = 1L;
public LianLianKan() {
LianLianKanJPanel llk = new LianLianKanJPanel();
add(llk);
}
class LianLianKanJPanel extends JPanel implements ActionListenerItemListener {
private static final long serialVersionUID = 1L;//序列化时为了保持版本的兼容性,即在版本升级时反序列化仍保持对象的唯一性。
private int[][] map = new int[8][8];//8*8的正方形
private int kind randomx randomy randomx1 randomy1; // 种类,随机x
private int coordinatex coordinatey coordinatex1 coordinatey1; // 坐标X
private Point lineStart = new Point(0 0);
private int clicktimes;
private int jishushengyu;//计数剩余
private int Kinds = 4;
private int score;
private int guanshu;//关数
loudou ld = new loudou();// 漏斗
JButton BlockButton[][] = new JButton[8][8];//
Choice difficultChoice = new Choice();
JButton newgameButton = new JButton(“重新开始“);
JButton reLoad = new JButton(“刷新“);
ImageIcon ii = new ImageIcon(“src/im/bk.jpg“);
ImageIcon aIcon = new ImageIcon(“src/im/1.gif“);
ImageIcon bIcon = new ImageIcon(“src/im/2.gif“);
ImageIcon cIcon = new ImageIcon(“src/im/3.gif“);
ImageIcon dIcon = new ImageIcon(“src/im/4.gif“);
ImageIcon eIcon = new ImageIcon(“src/im/5.gif“);
ImageIcon fIcon = new ImageIcon(“src/im/6.gif“);
ImageIcon gIcon = new ImageIcon(“src/im/7.gif“);
ImageIcon hIcon = new ImageIcon(“src/im/8.gif“);
ImageIcon iIcon = new ImageIcon(“src/im/9.gif“);
ImageIcon jIcon = new ImageIcon(“src/im/10.gif“);
ImageIcon kIcon = new ImageIcon(“src/im/11.gif“);
ImageIcon lIcon = new ImageIcon(“src/im/12.gif“);
ImageIcon mIcon = new ImageIcon(“src/im/13.gif“);
ImageIcon nIcon = new ImageIcon(“src/im/14.gif“);
ImageIcon oIcon = new ImageIcon(“src/im/15.gif“);
public LianLianKanJPanel() {
this.setLayout(null);
newMap();
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
BlockButton[i][j] = new JButton();
add(BlockButton[i][j]);
BlockButton[i][j].addActionListener(this);//监听器
BlockButton[i][j].setBounds(30 + j * 40 30 + i * 40 3134);
// BlockButton[i][j].setBorderPainted(false);
// BlockButton[i][j].setVisible(true);
}
}
difficultChoice.add(“简单“);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-18 10:19 lianliankan\
文件 299 2018-05-18 10:15 lianliankan\.classpath
文件 387 2018-05-18 10:15 lianliankan\.project
目录 0 2018-05-18 10:19 lianliankan\.settings\
文件 598 2018-05-18 10:19 lianliankan\.settings\org.eclipse.jdt.core.prefs
目录 0 2018-05-18 10:20 lianliankan\bin\
文件 301 2018-05-18 10:19 lianliankan\bin\.classpath
文件 380 2018-05-18 10:19 lianliankan\bin\.project
目录 0 2018-05-18 10:20 lianliankan\bin\.settings\
文件 598 2018-05-18 10:20 lianliankan\bin\.settings\org.eclipse.jdt.core.prefs
目录 0 2018-05-18 10:20 lianliankan\bin\im\
文件 1681 2018-05-18 10:20 lianliankan\bin\im\1.gif
文件 1652 2018-05-18 10:20 lianliankan\bin\im\10.gif
文件 1656 2018-05-18 10:20 lianliankan\bin\im\11.gif
文件 1632 2018-05-18 10:20 lianliankan\bin\im\12.gif
文件 1663 2018-05-18 10:20 lianliankan\bin\im\13.gif
文件 1647 2018-05-18 10:20 lianliankan\bin\im\14.gif
文件 1651 2018-05-18 10:20 lianliankan\bin\im\15.gif
文件 1652 2018-05-18 10:20 lianliankan\bin\im\2.gif
文件 1646 2018-05-18 10:20 lianliankan\bin\im\3.gif
文件 1634 2018-05-18 10:20 lianliankan\bin\im\4.gif
文件 1669 2018-05-18 10:20 lianliankan\bin\im\5.gif
文件 1574 2018-05-18 10:20 lianliankan\bin\im\6.gif
文件 1639 2018-05-18 10:20 lianliankan\bin\im\7.gif
文件 1636 2018-05-18 10:20 lianliankan\bin\im\8.gif
文件 1626 2018-05-18 10:20 lianliankan\bin\im\9.gif
文件 5142 2018-05-18 10:20 lianliankan\bin\im\bk.jpg
文件 3365 2018-05-18 10:19 lianliankan\bin\LianLianKan$LianLianKanJPanel$loudou.class
文件 13163 2018-05-18 10:19 lianliankan\bin\LianLianKan$LianLianKanJPanel.class
文件 1685 2018-05-18 10:19 lianliankan\bin\LianLianKan.class
目录 0 2018-05-18 10:20 lianliankan\src\
............此处省略22个文件信息
评论
共有 条评论