作业帮 > 作文素材 > 教育资讯

打地鼠游戏的作文

来源:学生作业帮助网 编辑:作业帮 时间:2024/09/24 07:18:05 作文素材
打地鼠游戏的作文作文素材

篇一:打地鼠小游戏

《打地鼠小游戏》项目文档

一.设计思路

四.关键代码源

线程实现老鼠的出现与消失

class mousexc implements Runnable{

public void run() {

try {

while(y<40){

y=y+1;

Random suijishu=new Random(); x=suijishu.nextInt((6)+1);

if(x==1){

jbmouse.setBounds(120, 120, 90, 30); jlmouse.setBounds(120,150, 90, 120); }

(来自:WWw.SmhaiDa.com 海达范文网:打地鼠游戏的作文)

if(x==2){

jbmouse.setBounds(340, 160, 90, 30); jlmouse.setBounds(340,190, 90, 120); }

if(x==3){

jbmouse.setBounds(620, 120, 90, 30); jlmouse.setBounds(620,150, 90, 120); }

if(x==4){

jbmouse.setBounds(570, 250, 90, 30); jlmouse.setBounds(570,280, 90, 120); }

if(x==5){

jbmouse.setBounds(70, 250, 90, 30); jlmouse.setBounds(70,280, 90, 120); }

if(x==6){

jbmouse.setBounds(300, 360, 90, 30); jlmouse.setBounds(300,390, 90, 120);

}

Thread.sleep(v);

v=v-20;

}

System.out.println("游戏结束你的得分是"+z); }

catch (InterruptedException e) {

e.printStackTrace();}

}

六.程序界面

七.编程中出现的问题:

1.不知道怎样在线程中调用自己编写的类中的方法;

篇二:打地鼠游戏要求

打地鼠游戏要求

游戏目的

通过用户参与游戏,达到哈多网网站用户之间互动的目的,并能多邀请一些用户参与到游戏里面进来。

游戏规则

用户通过哈多网的应用进入《打地鼠》游戏,游戏初期设置为4个等级,每个等级洞的数量和地鼠冒出的速度不一样,用户通过参与地鼠游戏可以获得网站的积分奖励。

在每个级别,用户需要邀请和洞的数目一样多的用户同意加入,才能开始游戏。

每个洞地鼠出现时,上面有用户的头像。

游戏分成4个级别

1. 4个洞

2. 9个洞,速度比上一个等级加快

3. 16个洞,速度比上一个等级加快

4. 25个洞,速度比上一个等级加快

UI要求

考虑到哈多网目标用户群是白领用户,游戏背景最好是办公场景,

或者有办公的元素在里面,

界面细致精美。

以下是网上截取的某打地鼠游戏的图,不作为UI风格参考。

篇三:游戏趣事

游戏趣事

作文课的时候,我们玩了一个真人版“打地鼠”,我现在跟大家说说几件有趣的事吧!

游戏开始了,只见白老师拿着书看着王俊儒,我以为白老师肯定是要打他了,没想到白老师快速地一转身,指向了张轶婧,张轶婧飞快地蹲下,但是白老师的速度太快了,张轶婧蹲得太猛,摔了一个屁股蹲儿,等到她坐在地上的时候,才反应过来自己逃出了白老师的“魔书”。同学们都乐翻了!我看懂了白老师的“计谋”,就是看这个打那个。我心想:等拍到我对面的徐鸿飞的时候,我可要多注意了!

白老师又把目标对准了郑国庆,可是郑国庆太矮了,白老师一转身都打不到他,看来矮也有矮的好处啊!这不就用上了吗?郑国庆站在那,他走神儿了,白老师突然一打,郑国庆虽然没反应到,但是他太矮了,白老师居然没有打到! 这个游戏真有趣!我希望以后还可以将继续玩,多测试测试我们的灵敏度和反应度!

天津市杨柳青第一小学四年级:白雪

篇四:打地鼠游戏设计论文

打地鼠游戏机(B题)

2011级华工 猫酷队

队员 李腾辉 陈健锋 蔡旭坤

我们的作品录像:http://v.youku.com/v_show/id_XMzkzMTIxMjgw.html

公布论文和全部源码,仅供学习

摘要:本作品采用STC12C5A60S22单片机作为主控芯片,选取1602液晶作为显示屏,通过红外接收器用遥控控制游戏机的开机和关机。游戏程序应用C语言编译,主要使用函数为随机函数和键盘扫描函数。通过随机函数产生一个随机数,该随机数使显示屏对应位置出现“O”,同时对应的LED被点亮以代表地鼠的随机出现。通过键盘扫描函数,使每个按键各对应一个LED灯,通过按下该键使相应LED灯熄灭。本系统配有开场音乐和游戏音效。 关键词:单片机、随机函数、键盘扫描函数、音乐

Abstract: this work using STC12C5A60S2 microcontroller as the main control chip select LCD as a display,1602, through the infrared receiver remote control game startup and shutdown. This game program using C language editing, the main function used are the random function and keyboard scan function. Use random functions to generate a random number, at the same time the random number to display the corresponding position"0" and the corresponding LED is illuminated to represent the random hamster. Through the keyboard scan function, make each key corresponds to a LED lamp, by pressing this key to the corresponding LED lights. The whole process has background music and game sound.

Key words: SCM, random function, keyboard scan function, music

游戏说明:

本游戏由8个LED灯分别代表8只地鼠,当地鼠跳出来时显示屏对应位置出现“O”,同时该地鼠对应的LED灯被点亮,在限定时间内按下相应按键后,对应LED灯熄灭,同时“O”闪烁一下,表示打中该地鼠。游戏规则为,打中1~8号地鼠,每只得一分,在每局限定的时间30秒内得满当前关所需分即可进入一下关。游戏分四关:第一关,地鼠跳出时间长,得10分后,游戏进入第二关;第二关,地鼠跳出时间较短,得15分后,游戏进入第三关;第三关,地鼠跳出时间更快,得20分后,游戏进入第四关。第四关,得25分可过,但超越人类反应极限,不作阐述。

方案比较、设计:

方案一:用STC89C52作主控芯片,灯光表示地鼠,用红外遥控系统,用两层板完成整

个电路。

方案二:用STC12C5A60S2作主控芯片,用灯光和液晶“0”表示地鼠,加入音乐,用

红外遥控系统,用一层板完成整个电路。

显然,方案二更加适合,因为方案二中采用的主控芯片运算的速度要比方案一所用芯片快得多(达8倍),ram足够,而且游戏系统使用了定时中断函数,用STC12C5A60S2芯片会得到更快的响应。而且方案二加入了液晶显示和音乐,使游戏不那么单调,使玩家更好体现游戏的过程。最后,用一层板可以减少很多飞线,而且布局美观。

电路原理:

本系统包含六个子电路模块,分别为单片机系统电路、流水灯电路、蜂鸣器电路、2*4矩阵键盘、遥控红外接收电路、1602LCD显示屏模块。

单片机系统电路

流水灯电路

蜂鸣器电路

2*4矩阵键盘

遥控红外接收电路

1602液晶显示模块电路

各模块整合并接上电源后,通过遥控打开游戏系统。随后,单片机系统驱动游戏系统进入初始化模式,同时蜂鸣器系统被驱动开始播放背景音乐。游戏开始后,背景音乐停止,单片机系统开始随机驱动8个LED灯点亮,同时液晶上对应位置出现O,蜂鸣器系统同时被驱动,发出“嘀”一声。此过程中,系统不断计时,不断刷新分数。

游戏实现代码:

//begin_display//

#ifndef BeginDisplay_H

#define BeginDisplay_H

//#include

#include

#define uchar unsigned char

#define uint unsigned int

sbit lcden=P3^4;

sbit lcdrs=P3^5;

sbit dula=P2^6;

sbit wela=P2^7;

//sbit bemp=P2^3;

int runlight[9]={0xff,0xfe,0xfd,0xfb,0xf7,

0xef,0xdf,0xbf,0x7f} ;

uchar run_light_num,kkk; //流水灯亮到哪一盏,kkk为定时0计数

uchar begin_flag,time_counter,mouse_hit;

篇五:打地鼠游戏代码

/*主窗体界面

* MousGame.java

*

* Created on __DATE__, __TIME__

*/

package com.insigma.mousgame;

import java.awt.Cursor;

import java.awt.Dimension;

import java.awt.Point;

import java.awt.Toolkit;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import javax.swing.ImageIcon;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import com.insigma.util.Catcher;

import com.insigma.util.CommUtil;

import com.insigma.util.Image;

import com.insigma.util.Time;

/**

*

* @author __USER__

*/

public class MousGame extends javax.swing.JFrame implements Runnable {

private JLabel[] mouse = new JLabel[9];

/** Creates new form MousGame */

public MousGame()

{

initComponents();

// 设置窗体不能变大

setResizable(false);

// 设置背景图片

JLabel background = new JLabel(Image.background); jPanel1.setOpaque(false);

jPanel1.add(background, new Integer(Integer.MIN_VALUE)); background.setBounds(0, 0, Image.background.getIconWidth(), Image.background.getIconHeight());

mouse[0] = jLabel1; mouse[0].setBounds(135, 120, 80, 70); mouse[0].addMouseListener(new Catcher()); mouse[1] = jLabel2; mouse[1].setBounds(280, 120, 80, 70); mouse[1].addMouseListener(new Catcher()); mouse[2] = jLabel3; mouse[2].setBounds(414, 120, 80, 70); mouse[2].addMouseListener(new Catcher()); mouse[3] = jLabel4; mouse[3].setBounds(128, 202, 80, 70); mouse[3].addMouseListener(new Catcher()); mouse[4] = jLabel5; mouse[4].setBounds(273, 202, 80, 70); mouse[4].addMouseListener(new Catcher()); mouse[5] = jLabel6; mouse[5].setBounds(430, 202, 80, 70); mouse[5].addMouseListener(new Catcher()); mouse[6] = jLabel7; mouse[6].setBounds(91, 320, 80, 70); mouse[6].addMouseListener(new Catcher()); mouse[7] = jLabel8; mouse[7].setBounds(279, 320, 80, 70); mouse[7].addMouseListener(new Catcher()); mouse[8] = jLabel9; mouse[8].setBounds(461, 320, 80, 70); mouse[8].addMouseListener(new Catcher()); // 使用绝对定位控制label在pane中的位置,与图片对应 jPanel1.setLayout(null); // 设置面板大小 jPanel1.setPreferredSize(new Dimension(Image.background.getIconWidth(), Image.background.getIconHeight())); // 鼠标样式 Toolkit toolkit = Toolkit.getDefaultToolkit();

} new Point(0, 0), "normal"); Cursor cursor2 = toolkit.createCustomCursor( Image.hammer_down.getImage(), new Point(0, 0), "capture"); // 鼠标监听器 addMouseListener(new MouseCrab(cursor1, cursor2)); for (int i = 0; i < mouse.length; i++) { mouse[i].addMouseListener(new MouseCrab(cursor1, cursor2)); } //GEN-BEGIN:initComponents // private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTextField1.setEditable(false); jTextField1.setFont(new java.awt.Font("黑体", 1, 18)); jTextField1.setForeground(new java.awt.Color(51, 255, 0)); jTextField2.setEditable(false); jTextField2.setFont(new java.awt.Font("楷体", 1, 18)); jTextField2.setForeground(new java.awt.Color(153, 0, 153)); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource( "/com/insigma/img/start.png"))); // NOI18N

{ public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel10MouseClicked(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout( jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(56, 56, 56) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(

.createSequentialGroup() .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup( jPanel1Layout .createSequentialGroup() .addComponent( jLabel4) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel5)) .addGroup( jPanel1Layout

作文素材