HTML5(石头剪刀布游戏开发)
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>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。