下载此文档

iOS,Game模板碰撞检测的一些细节.doc


文档分类:IT计算机 | 页数:约22页 举报非法文档有奖
1/22
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/22 下载此文档
文档列表 文档介绍
iOS,Game模板碰撞检测的一些细节篇一:jQuery+DIV碰撞检测(猫捉老鼠游戏)!--何奕勇-heyiyong-qq-290248126说明:jQuery+DIV碰撞检测(猫捉老鼠游戏)--!DOCTYPEhtmlhtmlheadtitledemo/titlestyletype="text/css"*{padding:0;margin:0;}.mao{background:#ff6e06;position:fixed;width:50px;height:50px;font-size:25px;line-height:50px;text-align:center;z-index:100;}.laoshu{background:#21ff00;position:fixed;top:300px;left:500px;width:100px;height:100px;font-size:25px;text-align:center;line-height:100px;}.result{height:80px;width:300px;background:#ffafb9;color:#219aff;font-weight:bolder;font-size:30px;text-align:center;margin:10pxauto;line-height:80px;}/stylescripttype="text/javascriptsrc="jquery-"/scriptscripttype="text/javascript"varmaoX=0;//水平方向位移varmaoY=0;//垂直方向位移varlaoshuX=500;//水平方向位移varlaoshuY=300;//垂直方向位移/***上下左右移动事件*/$(document).keydown(function(event){if(===37){maoY=maoY-10;$("#mao").css("left",maoY+"px");}elseif(===38){maoX=maoX-10;$("#mao").css("top",maoX+"px");}elseif(===39){maoY=maoY+10;$("#mao").css("left",maoY+"px");}elseif(===40){maoX=maoX+10;$("#mao").css("top",maoX+"px");}});functionpengzhuangCheck(){//得到猫的高度和宽度以及(距离左侧和上端的距离)varmaoOffset=$("#mao").offset();varmaoWidth=parseInt($("#mao").css("width").replace("px",""));varmaoHeight=parseInt($("#mao").css("height").replace("px",""));//得到老鼠的高度和宽度以及(距离左侧和上端的距离)varlaoshuOffset=$("#laoshu").offset();varlaoshuHeight=parseInt($("#laoshu").css("height").replace("px",""));varlaoshuWidth=parseInt($("#laoshu").css("width").replace("px",""));//左侧和上方相交的bool值varleftBool;vartopBool;//处理左侧相交if(){leftBool=--laoshuWidth0;//(&quo

iOS,Game模板碰撞检测的一些细节 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数22
  • 收藏数0 收藏
  • 顶次数0
  • 上传人1294838662
  • 文件大小64 KB
  • 时间2020-09-08