码迷,mamicode.com
首页 > Web开发 > 详细

HTML5(石头剪刀布游戏开发)

时间:2014-11-12 19:39:02      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   os   java   sp   

 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
 2     pageEncoding="UTF-8"%>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 4 <html>
 5 <head>
 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 7 <title>HTML5-lufyLegend测试</title>
 8 <script type="text/javascript" src="js/lufylegend-1.5.1.min.js"></script>
 9 <script type="text/javascript" src="js/Box2dWeb-2.1.a.3.min.js"></script>
10 <script type="text/javascript" src="js/jquery.js"></script>
11 <script type="text/javascript">
12     $(function(){
13         var backLayer = "";
14         var resultLayer = "";
15         var clickLayer = "";
16         var loadingLayer = "";
17         var imageList = {};
18         var imageData = new Array(
19                          { name:"title",path:"image/title.png"},
20                          { name:"shitou",path:"image/shitou.png"},
21                          { name:"jiandao",path:"image/jiandao.png"},
22                          { name:"bu",path:"image/bu.png"}
23                         );
24         init(50,"mylegend",1500,500,main);
25         function main(){
26             backLayer = new LSprite();
27             addChild(backLayer);
28             loadingLayer = new LoadingSample3();
29             backLayer.addChild(loadingLayer);
30             LLoadManage.load(imageData,
31                     function(data){
32                         loadingLayer.setProgress(data);
33                     },function(result){
34                         imageList = result;
35                         backLayer.removeChild(loadingLayer);
36                         loadingLayer = null;
37                         //游戏界面初始化
38                         gameInit();
39                     });
40         }
41         function gameInit(){
42             backLayer.graphics.drawRect(1,"black",[0,0,600,600],true,"black");
43             backLayer.x = 500;
44             backLayer.y = 100;
45             //结果显示初始化
46             initialResult();
47             //操作层初始化
48             initialClick();
49         }
50         function initialResult(){
51             resultLayer = new LSprite();
52             resultLayer.graphics.drawRect(1,"black",[0,0,150,100],true,"white");
53             resultLayer.x = 10;
54             resultLayer.y = 100;
55             backLayer.addChild(resultLayer);
56         }
57         
58         function initialClick(){
59             clickLayer = new LSprite();
60             clickLayer.graphics.drawRect(1,"black",[0,0,250,100],true,"white");
61             clickLayer.x = 200;
62             clickLayer.y = 250;
63             backLayer.addChild(clickLayer);
64         }
65         
66         
67     });
68 </script>
69 </head>
70 <body>
71     <div id="mylegend">loading...</div>
72 </body>
73 </html>

 

HTML5(石头剪刀布游戏开发)

标签:style   blog   http   io   color   ar   os   java   sp   

原文地址:http://www.cnblogs.com/Wen-yu-jing/p/4093206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!