<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,body{
height: 100%;
overflow: hidden;
}
.main,.wordList{
width: 100%;
height: 100%;
overflow: hidden;
}
.wordItem{
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
border-radius: 50px;
background:navajowhite;
position: absolute;
top: 20px;
animation: wangxiadiao 10s linear forwards; }
@keyframes wangxiadiao{
from{
/*transform: translate(0,0);*/
top: 20px;
}
to{
/*transform: translate(0,1500px);*/
top: 1500px;
}
} .startgame{
width: 300px;
height: 150px;
background: orangered;
color: #fff;
text-align: center;
line-height: 150px;
border-radius: 30px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -75px;
font-size: 70px;
}
</style>
</head>
<body>
<div class="main">
<div class="wordList"> </div> <div class="menu">
<button class="startgame">游戏开始</button>
<h1>游戏结束剩余时间</h1>
<h1>当前得分:<span class="scroe"></span></h1> </div> </div> <script type="text/javascript"> var game = {
gData:{
wordList:document.querySelector('.wordList'),
newList:[]
domList:[]
},
startGame:function(){
//开始前,程序需要执行的内容
var btn = document.querySelector('.startgame')
btn.onclick = function(){
btn.style.display = 'none'
game.gameing()
} },
gameimg:function(){
//游戏中要执行的程序
var fn = function(){
var randomNum = parseInt(Math.random()*26)
var newDiv = document.createElement('div')
newDiv.innerHTML = word[randomNum]
newDiv.className = 'wordItem' game.gData.newList.push(word[randomNum])
game.gData.domList.push(newDiv) var x = Math.random()*(document.body.clientWidth-100)
newDiv.style.left = x + 'px' game.gData.wordList.appendChild(newDiv) var newWord = word[randomNum] setTimeout(function(){
var index = game.gData.newList.indexOf(newWord)
if(index!=-1){
wordList.removeChild(domList[index])
game.gData.newList.splice(index,1)
game.gData.domList.splice(index,1) } },10000) } var interId = setInterval(fn,2000) setTimeout(function(){
clearInterval(interId)
game.endGame()
},10000) },
//游戏结束的时候执行的函数
endGame:function(){
alert('游戏结束,你的得分是:')
}
} </script>
</body>
</html>

原版_打字游戏.html的更多相关文章

  1. 用JS写了一个打字游戏,反正我是通不了关

    今天想写个简单的游戏, 打字游戏好像都没写过, 那么就写打字游戏吧, gamePad包含了关卡的信息, 可以用来调整给个关卡字符下落的速度: getRandom函数会返回一个字符对象, 这个对象包含了 ...

  2. java打字游戏

    小记:老早之前写的程序,今天发现之前在 csdn上写的东西的图片不显示了,搞得人好郁闷,所以把之前零星的几篇文章搬个家 游戏运行截图: 字母实体类 package com.git.game; impo ...

  3. Java之线程———GUI线程(包含打字游戏和计时器俩个GUI实列)

    当java程序包含图形用户界面(GUI)时,Java虚拟机在运行应用程序时会自动启动更多的线程,其中有两个重要的线程:AWT-EventQuecue 和 AWT-Windows. AWT-EventQ ...

  4. jQuery 写的简单打字游戏

    var off_x; //横坐标 var count=0; //总分 var speed=5000; //速度,默认是5秒. var keyErro=0; //输入错误次数 var keyRight= ...

  5. linux系统指法练习与打字游戏软件

    以 fedora和ubuntu 系统为例,fedora/centos系统用yum install命令安装 ubuntu系统用apt-get instll命令安装 yum install ktouch$ ...

  6. JavaScript实现简单的打字游戏

    完整项目下载:https://download.csdn.net/download/weixin_44893902/13131694 演示地址:https://url_777.gitee.io/typ ...

  7. Java_太阳系_行星模型_小游戏练习_详细注释

    //实现MyFrame--实现绘制窗口,和实现重写 重画窗口线程类 package cn.xiaocangtian.Test; import java.awt.Frame; import java.a ...

  8. [蓝桥杯]PREV-23.历届试题_数字游戏

    问题描述 栋栋正在和同学们玩一个数字游戏. 游戏的规则是这样的:栋栋和同学们一共n个人围坐在一圈.栋栋首先说出数字1.接下来,坐在栋栋左手边的同学要说下一个数字2.再下面的一个同学要从上一个同学说的数 ...

  9. C#_界面程序_数码游戏

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

随机推荐

  1. Spring MVC 梳理 - handlerMapping和handlerAdapter分析

    参考图片 综上所述我们来猜测一下spring mvc 中根据URL找到处理器Controller中相应方法的流程 ①:获取Request的URL ②:从UrlLookup这个map中找到相应的requ ...

  2. 阿里云安装zk并连接javaAPI测试

    1.安装 可参照Ubuntu 搭建Zookeeper服务进行安装并启动. 2.注意 阿里云环境开放2181端口 2.1 查看已开放端口: firewall-cmd --permanent --zone ...

  3. springboot 使用i18n进行国际化乱码解决

    方式1.设置国际化的编码和你使用的编译器(IDEA之类)一致,如编译器为UTF-8则在application配置文件中添加 #i18n spring: messages: encoding: UTF- ...

  4. 应用角度看kafka的术语和功能

    kafka的术语(Terminology) Topic 和Consumer Group Topic 每条发布到 Kafka 集群的消息都有一个类别,这个类别被称为 Topic.(物理上不同 Topic ...

  5. MongoDB安装过程中出现service MongoDB failed to start,verify that you have sufficient privileges to start...

    win10系统下,安装MongoDB 64位, service MongoDB failed to start,verify that you have sufficient privileges t ...

  6. Dedecms手机站三种不同建设方法和优劣分析

    dedecms简单易用功能强大,是国内使用最多的cms建站系统,百度站长平台专门推出了“织梦移动化指南”,由此可见dedecms的影响力.织梦也是站长使用和学习最早的cms建站系统,解放了我的双手,让 ...

  7. ElasticSearch实战系列三: ElasticSearch的JAVA API使用教程

    前言 在上一篇中介绍了ElasticSearch实战系列二: ElasticSearch的DSL语句使用教程---图文详解,本篇文章就来讲解下 ElasticSearch 6.x官方Java API的 ...

  8. Spring Boot 2.x 基础案例:整合Dubbo 2.7.3+Nacos1.1.3(最新版)

    1.概述 本文将介绍如何基于Spring Boot 2.x的版本,通过Nacos作为配置与注册中心,实现Dubbo服务的注册与消费. 整合组件的版本说明: Spring Boot 2.1.9 Dubb ...

  9. sbt 学习笔记(2)sbt生成项目导入eclipse

    在sbt配置eclipse插件 C:\Users\Administrator\.sbt\0.13\ 新建plugins目录,在目录中新建plugins.sbt 文件内容为: addSbtPlugin( ...

  10. java中的Math.ceil、Math.floor和Math.round

    ceil意为天花板,指向上取整:floor意为地板,指向下取整:round指四舍五入 package com.company; public class Main { public static vo ...