├── .laya ├── launch.json └── publish_window.json ├── Lolo-Horizon.laya ├── README.md ├── bin ├── index.html ├── libs │ ├── LayaRender.js │ ├── laya.ani.js │ ├── laya.core.js │ ├── laya.d3.js │ ├── laya.d3.min.js │ ├── laya.d3Plugin.js │ ├── laya.debugtool.js │ ├── laya.device.js │ ├── laya.filter.js │ ├── laya.html.js │ ├── laya.particle.js │ ├── laya.pathfinding.js │ ├── laya.tiledmap.js │ ├── laya.ui.js │ ├── laya.webgl.js │ ├── matter.js │ ├── min │ │ ├── laya.ani.min.js │ │ ├── laya.core.min.js │ │ ├── laya.d3.min.js │ │ ├── laya.d3Plugin.min.js │ │ ├── laya.debugtool.min.js │ │ ├── laya.device.min.js │ │ ├── laya.filter.min.js │ │ ├── laya.html.min.js │ │ ├── laya.particle.min.js │ │ ├── laya.pathfinding.min.js │ │ ├── laya.tiledmap.min.js │ │ ├── laya.ui.min.js │ │ └── laya.webgl.min.js │ ├── protobuf.js │ └── worker.js ├── res │ ├── BackGround.png │ ├── BackGround.png.bak.png │ ├── atlas │ │ ├── .rec │ │ ├── comp.atlas │ │ ├── comp.json │ │ ├── comp.png │ │ └── rec │ ├── bird │ │ ├── bird_1.png │ │ ├── bird_2.png │ │ ├── bird_3.png │ │ └── bird_4.png │ ├── cat_sleep.png │ ├── effect.png │ ├── floor.png │ ├── hp │ │ ├── en_bar.png │ │ ├── hp_bar.png │ │ └── hp_bg.png │ ├── item │ │ ├── item_1.png │ │ ├── item_2.png │ │ ├── item_3.png │ │ └── item_4.png │ ├── m_background.png │ ├── particle │ │ ├── heart.png │ │ └── particle.part │ ├── player.atlas │ ├── player.json │ ├── player.png │ ├── player │ │ ├── chara_01.png │ │ ├── chara_02.png │ │ ├── chara_03.png │ │ ├── chara_04.png │ │ ├── chara_05.png │ │ ├── chara_06.png │ │ ├── chara_07.png │ │ ├── chara_08.png │ │ ├── chara_09.png │ │ ├── chara_10.png │ │ ├── chara_11.png │ │ ├── chara_12.png │ │ ├── chara_13.png │ │ ├── chara_14.png │ │ ├── chara_15.png │ │ └── chara_16.png │ ├── rec │ ├── spiritEffect.png │ ├── tree0.png │ └── wav │ │ ├── BG.wav │ │ ├── DecelerationCounting.wav │ │ ├── InvincibleCounting.wav │ │ ├── Invincible_end.wav │ │ ├── Invincible_start.wav │ │ ├── LowerSpeed.wav │ │ └── StarCounting.wav └── unpack.json ├── jsconfig.json ├── laya ├── .laya └── assets │ └── comp │ ├── bg.png │ ├── blank.png │ ├── btn_close.png │ ├── button.png │ ├── checkbox.png │ ├── clip_num.png │ ├── clip_selectBox.png │ ├── clip_tree_arrow.png │ ├── clip_tree_folder.png │ ├── combobox.png │ ├── hscroll$bar.png │ ├── hscroll$down.png │ ├── hscroll$up.png │ ├── hscroll.png │ ├── hslider$bar.png │ ├── hslider.png │ ├── html.png │ ├── image.png │ ├── label.png │ ├── linkbutton.png │ ├── progress$bar.png │ ├── progress.png │ ├── radio.png │ ├── radiogroup.png │ ├── tab.png │ ├── textarea.png │ ├── textinput.png │ ├── vscroll$bar.png │ ├── vscroll$down.png │ ├── vscroll$up.png │ ├── vscroll.png │ ├── vslider$bar.png │ └── vslider.png ├── libs └── LayaAir.d.ts ├── rec.mp4 ├── release └── layaweb │ └── 1.0.0 │ ├── apk │ └── 洛洛地平线.apk │ ├── index.html │ ├── js │ ├── Config.js │ ├── init.js │ └── runGame │ │ ├── BackGround.js │ │ ├── EnergyBar.js │ │ ├── Floor.js │ │ ├── GameInfo.js │ │ ├── Item.js │ │ ├── Loading.js │ │ ├── MapFloor.js │ │ ├── Npc.js │ │ ├── Player.js │ │ └── RunGame.js │ ├── libs │ ├── LayaRender.js │ ├── laya.ani.js │ ├── laya.core.js │ ├── laya.d3.js │ ├── laya.d3.min.js │ ├── laya.d3Plugin.js │ ├── laya.debugtool.js │ ├── laya.device.js │ ├── laya.filter.js │ ├── laya.html.js │ ├── laya.particle.js │ ├── laya.pathfinding.js │ ├── laya.tiledmap.js │ ├── laya.ui.js │ ├── laya.webgl.js │ ├── matter.js │ ├── min │ │ ├── laya.ani.min.js │ │ ├── laya.core.min.js │ │ ├── laya.d3.min.js │ │ ├── laya.d3Plugin.min.js │ │ ├── laya.debugtool.min.js │ │ ├── laya.device.min.js │ │ ├── laya.filter.min.js │ │ ├── laya.html.min.js │ │ ├── laya.particle.min.js │ │ ├── laya.pathfinding.min.js │ │ ├── laya.tiledmap.min.js │ │ ├── laya.ui.min.js │ │ └── laya.webgl.min.js │ ├── protobuf.js │ └── worker.js │ ├── main.min.js │ ├── res │ ├── BackGround.png │ ├── BackGround.png.bak.png │ ├── atlas │ │ ├── .rec │ │ ├── comp.atlas │ │ ├── comp.json │ │ ├── comp.png │ │ └── rec │ ├── bird │ │ ├── bird_1.png │ │ ├── bird_2.png │ │ ├── bird_3.png │ │ └── bird_4.png │ ├── cat_sleep.png │ ├── effect.png │ ├── floor.png │ ├── hp │ │ ├── en_bar.png │ │ ├── hp_bar.png │ │ └── hp_bg.png │ ├── item │ │ ├── item_1.png │ │ ├── item_2.png │ │ ├── item_3.png │ │ └── item_4.png │ ├── m_background.png │ ├── particle │ │ ├── heart.png │ │ └── particle.part │ ├── player.atlas │ ├── player.json │ ├── player.png │ ├── player │ │ ├── chara_01.png │ │ ├── chara_02.png │ │ ├── chara_03.png │ │ ├── chara_04.png │ │ ├── chara_05.png │ │ ├── chara_06.png │ │ ├── chara_07.png │ │ ├── chara_08.png │ │ ├── chara_09.png │ │ ├── chara_10.png │ │ ├── chara_11.png │ │ ├── chara_12.png │ │ ├── chara_13.png │ │ ├── chara_14.png │ │ ├── chara_15.png │ │ └── chara_16.png │ ├── rec │ ├── spiritEffect.png │ ├── tree0.png │ └── wav │ │ ├── BG.wav │ │ ├── DecelerationCounting.wav │ │ ├── InvincibleCounting.wav │ │ ├── Invincible_end.wav │ │ ├── Invincible_start.wav │ │ ├── LowerSpeed.wav │ │ └── StarCounting.wav │ └── unpack.json ├── src ├── Config.js ├── init.js └── runGame │ ├── BackGround.js │ ├── EnergyBar.js │ ├── Floor.js │ ├── GameInfo.js │ ├── Item.js │ ├── Loading.js │ ├── MapFloor.js │ ├── Npc.js │ ├── Player.js │ └── RunGame.js ├── 洛洛地平线-功能函数文档.xls └── 落落地平线.pptx /.laya/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "layaAir", 6 | "type": "chrome", 7 | "request": "launch", 8 | "file": "${workspaceRoot}/bin/index.html", 9 | "runtimeExecutable": "${execPath}", 10 | "useBuildInServer": true, 11 | "sourceMaps": true, 12 | "webRoot": "${workspaceRoot}", 13 | "port": 9222, 14 | "fixedPort":false 15 | }, 16 | { 17 | "name": "chrome调试", 18 | "type": "chrome", 19 | "request": "launch", 20 | "url": "${workspaceRoot}/bin/index.html", 21 | // "换成自己的谷歌安装路径,": 比如 22 | //window 默认安装路径为: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" 23 | //mac 系统上的默认安装路径为 "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; 24 | // "runtimeExecutable": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", 25 | "runtimeArgs": [ 26 | "--allow-file-access-from-files", 27 | "--allow-file-access-frome-files", 28 | " --disable-web-security" 29 | ], 30 | "sourceMaps": true, 31 | "webRoot": "${workspaceRoot}", 32 | //假如谷歌调试报userDataDir不可用,请把谷歌安装路径取得管理员权限,或者更换${tmpdir}为其他可以读写的文件夹,也可以删除。 33 | "userDataDir": "${tmpdir}", 34 | "port":9222, 35 | "fixedPort":false 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /.laya/publish_window.json: -------------------------------------------------------------------------------- 1 | {"build":{"versionName":"v0.1","merge":false,"compress":false,"recompile":false,"regenerateUI":false,"regenerateAtlas":false},"pngquant":{"showAdvanceOptions":false,"colors":8,"speed":3,"quality":[50,90],"table":{"unselectedFiles":[]}}} -------------------------------------------------------------------------------- /Lolo-Horizon.laya: -------------------------------------------------------------------------------- 1 | {"proName":"Lolo-Horizon","version":"1.7.6beta","proType":2} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lolo-Horizon 2 | 洛洛地平线 3 | 4 | # [线上demo](http://118.89.31.177/) 5 | 6 | |落落地平线-功能函数文档||||||| 7 | |:--|:--|:--|:--|:--|:--|:--| 8 | |文件名(按照加载先后顺序)|函数|参数|返回值|说明|注意事项|备注| 9 | |Config.js||||基本的配置文件||| 10 | |GameInfo.js|GameInfo()|||显示游戏的信息,显示于最外层|适用于首次加载|| 11 | ||init()|(string)message||初始化|传入的文字直接显示在开始/结束的界面上|| 12 | |Loading.js|Loading()|||显示文件加载进度|适用于首次加载|| 13 | ||init()|||初始化|初始化loading界面|| 14 | ||progress()|(float/int)value||显示文件加载的具体进度|在loading显示的时候,传入的参数会被转化成int类型,直接显示loading进度|| 15 | |init.js|onLoading()|(float/int)progress||调用Loading.js -> progress(value)|一般是由Laya.loader.load()传入,表示加载文件的进度|全局| 16 | ||onLoaded()|||加载完成后的动作||全局| 17 | ||initGame()|(boolean)isRestartGame||初始化游戏|并不是移除所有资源,而是初始化相关的参数|全局| 18 | |BackGround.js|BackGround()|||显示背景||| 19 | ||init()|||初始化背景的相关东西|内含有音频,音频没有使用预加载|| 20 | ||onLoop()|||以帧循环处理背景|帧循环相关参数在Config.js里面可设置,但是设置不正确会导致看起来很卡|| 21 | |EnergyBar.js|EnergyBar()|(string)type||根据类型显示能量条|type的具体内容请参见EnergyBar.js内"//能量类型" 下代码|| 22 | ||init()|(string)type||根据类型初始化能量条|不同的type是不同的实例,请注意实例的使用问题|| 23 | ||updateEnergyValue()|(float/int)value||根据传入的数据自动判断并缩放进度条||| 24 | ||addEnergyValue()|(float/int)value||在原来的数值上加上value,再调用updateEnergyValue(value)||| 25 | |Floor.js|Floor()|||显示地板,地板指的是人物踩上去|地板的移动速度加快就会造成人物跑的很快的现象|| 26 | ||init()|||初始化地板||| 27 | ||onLoop()|||地板的帧循环处理函数|每一块地板都是有独立的帧循环处理函数实例,当此地板完全出屏幕时,会触发Floor.OUT_DIE事件,此事件位于MapFloor.js这个地板会被销毁,此实例函数也会被清理|| 28 | ||addItem()|||在地板上添加物品|会按照Config.js内定义的物品的概率来生成物品,然后添加在地板上|| 29 | ||getAllItems()|||获取当前地板上所有的道具||| 30 | ||addBird()|||放置NPC|当前npc只有鸟|| 31 | ||getAllNpcs()|||获取当前地板上所有的npc||| 32 | ||moveFaster()|||加快地板的移动速度直到最大值|最大值请参见Config.js|| 33 | ||moveLower()|||减小地板的移动速度,这里是直接使地板值为默认值|默认值请参见Config.js|| 34 | ||checkHit()|(float/int)playerX, (float/int)playerY, (string:"up"/"down")playerStatus||判断玩家是否在地板上|这里仅仅是玩家从上方掉下来,判断是否踩到了地板|| 35 | |Item.js|Item()|||各种道具||| 36 | ||init()|(string)type||根据类型绘制道具||| 37 | ||TweenStar()|(object)item||播放人物碰到道具的效果|这个功能会影响到分数,在播放的几百毫秒内,分数会一直增加|bug| 38 | ||randomItemPosition()|(object)item|(object)item|随机道具的上下位置|传入一个实例,修改该实例的y值和旋转该道具,然后返回该实例|| 39 | |MapFloor.js|MapFloor()|||对地板进行管理||| 40 | ||init()|||初始化地板管理类||| 41 | ||onLoop()|||地板管理类使用帧循环处理地板||| 42 | ||addFloor()||(object)floor|增加地板||| 43 | ||getFloor()||(object)floor|获取一个全新的地板|调用是addFloor()|| 44 | ||delFloor()|(object)floor||删除地板||| 45 | |Npc.js|Npc()|||这个是npc相关的类||| 46 | ||init()|||初始化NPC||| 47 | ||onLoop()|||帧循环处理npc||| 48 | ||randomNpcPosition()|(object)bird|(object)bird|随机npc的上下位置|传入一个实例,修改该实例的y值和旋转该道具,然后返回该实例|| 49 | |Player.js|Player()|(object)decelerationEnergy, (object)invincibleEnergy||游戏玩家相关的类|传入的实例应当是以不同的类型产生的不同实例,请参见EnergyBar的说明|| 50 | ||init()|||初始化人物的相关动作||| 51 | ||onLoop()|||以帧循环处理人物动作|例如人物的跑动等状态|| 52 | ||playAction()|(string)action||播放人物的动作|会自动判断是否是重复动作,如果是,就不执行|| 53 | ||hitCheck()|(float/int)playerX,(float/int)playerY,(float/int)itemX,(float/int)itemY,(string:"up"/"down")itemDirectionStatus,(string)itemTpye,(string:"up"/"down")playerStatus|(boolean)isHit|判断人物是否和道具/npc相撞|需要注意的是item的坐标和player的坐标是不相同的,item的坐标参考系是地板,player的坐标参考系是整个屏幕.|| 54 | ||gotoRun()|||播放跑动的动画|调用的是playAction()函数|| 55 | ||gotoFly()|||播放飞行的动画|调用的是playAction()函数|| 56 | ||flip()|||以x轴镜像翻转人物|需要自己设置人物的y值|| 57 | ||showEffect()|||显示无敌状态下的特效|会调用到Showparticle()|| 58 | ||Showparticle()|||播放粒子效果||| 59 | ||hideEffect()|||隐藏特效||| 60 | |RunGame.js|RunGame()|||游戏入口函数||| 61 | ||init()|||游戏的初始化|以上所有的东西都在这里定义并调用|| 62 | ||onLoop()|||帧循环处理整个游戏|这里处理了碰撞事件|| 63 | ||scoreAdd()|(int)value||积分栏的增加||| 64 | ||onMouseDown()|||监听鼠标按下的事件|这里每按下一次就翻转一次人物|| 65 | ||stopAllGame()|||停止整个游戏|关键值恢复成默认值,不清除缓存|| 66 | -------------------------------------------------------------------------------- /bin/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 洛洛地平线 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /bin/libs/LayaRender.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Matter.js 渲染器在 LayaAir 的实现。 3 | */ 4 | (function() 5 | { 6 | var LayaRender = {}; 7 | 8 | var Common = Matter.Common; 9 | var Composite = Matter.Composite; 10 | var Bounds = Matter.Bounds; 11 | var Events = Matter.Events; 12 | var Grid = Matter.Grid; 13 | var Vector = Matter.Vector; 14 | 15 | /** 16 | * 创建新的渲染器。 17 | * @param {object} options 所有属性都有默认值,options中的属性会覆盖默认属性。 18 | * @return {render} 返回创建的旋绕器 19 | */ 20 | LayaRender.create = function(options) 21 | { 22 | var defaults = { 23 | controller: LayaRender, 24 | engine: null, 25 | element: null, 26 | canvas: null, 27 | mouse: null, 28 | frameRequestId: null, 29 | options: 30 | { 31 | width: 800, 32 | height: 600, 33 | pixelRatio: 1, 34 | background: '#fafafa', 35 | wireframeBackground: '#222222', 36 | hasBounds: !!options.bounds, 37 | enabled: true, 38 | wireframes: true, 39 | showSleeping: true, 40 | showDebug: false, 41 | showBroadphase: false, 42 | showBounds: false, 43 | showVelocity: false, 44 | showCollisions: false, 45 | showSeparations: false, 46 | showAxes: false, 47 | showPositions: false, 48 | showAngleIndicator: false, 49 | showIds: false, 50 | showShadows: false, 51 | showVertexNumbers: false, 52 | showConvexHulls: false, 53 | showInternalEdges: false, 54 | showMousePosition: false 55 | } 56 | }; 57 | var render = Common.extend(defaults, options); 58 | render.mouse = options.mouse; 59 | render.engine = options.engine; 60 | // 如果用户没有指定contaienr,默认使用stage 61 | render.container = render.container || Laya.stage; 62 | render.bounds = render.bounds || 63 | { 64 | min: 65 | { 66 | x: 0, 67 | y: 0 68 | }, 69 | max: 70 | { 71 | x: render.width, 72 | y: render.height 73 | } 74 | }; 75 | 76 | return render; 77 | } 78 | 79 | /** 80 | * 运行渲染器。 81 | * @param {render} render 渲染的目标是LayaRender.create()返回的对象 82 | * @return {void} 83 | */ 84 | LayaRender.run = function(render) 85 | { 86 | Laya.timer.frameLoop(1, this, LayaRender.world, [render]); 87 | Events.on(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite); 88 | }; 89 | 90 | /** 91 | * 停止渲染器。 92 | * @param {render} LayaRender.create()返回的对象 93 | * @return {void} 94 | */ 95 | LayaRender.stop = function(render) 96 | { 97 | Laya.timer.clear(this, LayaRender.world); 98 | Events.off(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite); 99 | } 100 | 101 | LayaRender.onRemoveSprite = function(args) 102 | { 103 | var sprite = args.object.layaSprite; 104 | if (sprite && sprite.parent) 105 | sprite.parent.removeChild(sprite); 106 | } 107 | 108 | /** 109 | * 渲染给定的 engine 的 Matter.World 对象。 110 | * 这是渲染的入口,每次场景改变时都应该被调用。 111 | * @param {render} render 112 | * @return {void} 113 | */ 114 | LayaRender.world = function(render) 115 | { 116 | var engine = render.engine, 117 | world = engine.world, 118 | renderer = render.renderer, 119 | container = render.container, 120 | options = render.options, 121 | bodies = Composite.allBodies(world), 122 | allConstraints = Composite.allConstraints(world), 123 | constraints = [], 124 | i; 125 | 126 | if (options.wireframes) 127 | { 128 | LayaRender.setBackground(render, options.wireframeBackground); 129 | } 130 | else 131 | { 132 | LayaRender.setBackground(render, options.background); 133 | } 134 | 135 | // 处理 bounds 136 | var boundsWidth = render.bounds.max.x - render.bounds.min.x, 137 | boundsHeight = render.bounds.max.y - render.bounds.min.y, 138 | boundsScaleX = boundsWidth / render.options.width, 139 | boundsScaleY = boundsHeight / render.options.height; 140 | 141 | if (options.hasBounds) 142 | { 143 | // 隐藏不在视口内的bodies 144 | for (i = 0; i < bodies.length; i++) 145 | { 146 | var body = bodies[i]; 147 | body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds); 148 | } 149 | 150 | // 过滤掉不在视口内的 constraints 151 | for (i = 0; i < allConstraints.length; i++) 152 | { 153 | var constraint = allConstraints[i], 154 | bodyA = constraint.bodyA, 155 | bodyB = constraint.bodyB, 156 | pointAWorld = constraint.pointA, 157 | pointBWorld = constraint.pointB; 158 | 159 | if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); 160 | if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); 161 | 162 | if (!pointAWorld || !pointBWorld) 163 | continue; 164 | 165 | if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) 166 | constraints.push(constraint); 167 | } 168 | 169 | // 改变视口 170 | container.scale(1 / boundsScaleX, 1 / boundsScaleY); 171 | container.pos(-render.bounds.min.x * (1 / boundsScaleX), -render.bounds.min.y * (1 / boundsScaleY)); 172 | } 173 | else 174 | { 175 | constraints = allConstraints; 176 | } 177 | 178 | for (i = 0; i < bodies.length; i++) 179 | LayaRender.body(render, bodies[i]); 180 | 181 | for (i = 0; i < constraints.length; i++) 182 | LayaRender.constraint(render, constraints[i]); 183 | }; 184 | 185 | /** 186 | * 设置背景色或者背景图片。 187 | * @param {render} render 188 | * @param {string} background 16进制颜色字符串或者图片路径 189 | */ 190 | LayaRender.setBackground = function(render, background) 191 | { 192 | if (render.currentBackground !== background) 193 | { 194 | var isColor = background.indexOf && background.indexOf('#') !== -1; 195 | 196 | render.container.graphics.clear(); 197 | 198 | if (isColor) 199 | { 200 | // 使用纯色背景 201 | render.container.bgColor = background; 202 | } 203 | else 204 | { 205 | render.container.loadImage(background); 206 | // 使用背景图片时把背景色设置为白色 207 | render.container.bgColor = "#FFFFFF"; 208 | } 209 | 210 | render.currentBackground = background; 211 | } 212 | } 213 | 214 | /** 215 | * 渲染 body 216 | * @param {render} render 217 | * @param {body} body 218 | * @return {void} 219 | */ 220 | LayaRender.body = function(render, body) 221 | { 222 | var engine = render.engine, 223 | bodyRender = body.render; 224 | 225 | if (!bodyRender.visible) 226 | return; 227 | 228 | // 有纹理的body 229 | if (bodyRender.sprite && bodyRender.sprite.texture) 230 | { 231 | var spriteId = 'b-' + body.id, 232 | sprite = body.layaSprite, 233 | container = render.container; 234 | 235 | // 如果sprite不存在,则初始化一个 236 | if (!sprite) 237 | sprite = body.layaSprite = _createBodySprite(render, body); 238 | 239 | // 如果sprite未在显示列表,则添加至显示列表 240 | if (!container.contains(sprite)) 241 | container.addChild(sprite); 242 | 243 | // 更新sprite位置 244 | sprite.x = body.position.x; 245 | sprite.y = body.position.y; 246 | sprite.rotation = body.angle * 180 / Math.PI; 247 | sprite.scaleX = bodyRender.sprite.xScale || 1; 248 | sprite.scaleY = bodyRender.sprite.yScale || 1; 249 | } 250 | else // 没有纹理的body 251 | { 252 | var primitiveId = 'b-' + body.id, 253 | sprite = body.layaSprite, 254 | container = render.container; 255 | 256 | // 如果sprite不存在,则初始化一个 257 | if (!sprite) 258 | { 259 | sprite = body.layaSprite = _createBodyPrimitive(render, body); 260 | } 261 | 262 | // 如果sprite未在显示列表,则添加至显示列表 263 | if (!container.contains(sprite)) 264 | container.addChild(sprite); 265 | 266 | // 更新sprite位置 267 | sprite.x = body.position.x; 268 | sprite.y = body.position.y; 269 | } 270 | }; 271 | 272 | /** 273 | * 创建使用纹理的Sprite对象。 274 | * @param {render} render 275 | * @param {body} body 276 | * @return {void} 277 | */ 278 | var _createBodySprite = function(render, body) 279 | { 280 | var bodyRender = body.render, 281 | texturePath = bodyRender.sprite.texture, 282 | sprite = new Laya.Sprite(); 283 | 284 | sprite.loadImage(texturePath); 285 | sprite.pivotX = body.render.sprite.xOffset; 286 | sprite.pivotY = body.render.sprite.yOffset; 287 | 288 | return sprite; 289 | }; 290 | 291 | /** 292 | * 创建使用矢量绘图的Sprite对象。 293 | * @param {render} render 294 | * @param {body} body 295 | * @return {void} 296 | */ 297 | var _createBodyPrimitive = function(render, body) 298 | { 299 | var bodyRender = body.render, 300 | options = render.options, 301 | sprite = new Laya.Sprite(), 302 | fillStyle, strokeStyle, lineWidth, 303 | part, points = []; 304 | 305 | var primitive = sprite.graphics; 306 | primitive.clear(); 307 | 308 | // 处理 compound parts 309 | for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) 310 | { 311 | part = body.parts[k]; 312 | 313 | if (!options.wireframes) 314 | { 315 | fillStyle = bodyRender.fillStyle; 316 | strokeStyle = bodyRender.strokeStyle; 317 | lineWidth = bodyRender.lineWidth; 318 | } 319 | else 320 | { 321 | fillStyle = null; 322 | strokeStyle = '#bbbbbb'; 323 | lineWidth = 1; 324 | } 325 | 326 | points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); 327 | 328 | for (var j = 1; j < part.vertices.length; j++) 329 | { 330 | points.push(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y); 331 | } 332 | 333 | points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); 334 | 335 | primitive.drawPoly(0, 0, points, fillStyle, strokeStyle, lineWidth); 336 | 337 | // 角度指示器 338 | if (options.showAngleIndicator || options.showAxes) 339 | { 340 | primitive.beginFill(0, 0); 341 | 342 | lineWidth = 1; 343 | if (options.wireframes) 344 | { 345 | strokeStyle = '#CD5C5C'; 346 | } 347 | else 348 | { 349 | strokeStyle = bodyRender.strokeStyle; 350 | } 351 | 352 | primitive.drawLine(part.position.x - body.position.x, part.position.y - body.position.y, 353 | ((part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x), 354 | ((part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y)); 355 | } 356 | } 357 | 358 | return sprite; 359 | }; 360 | 361 | /** 362 | * 绘制 constraint。 363 | * @param {render} render 364 | * @param {constraint} constraint 365 | * @return {void} 366 | */ 367 | LayaRender.constraint = function(render, constraint) 368 | { 369 | var engine = render.engine, 370 | bodyA = constraint.bodyA, 371 | bodyB = constraint.bodyB, 372 | pointA = constraint.pointA, 373 | pointB = constraint.pointB, 374 | container = render.container, 375 | constraintRender = constraint.render, 376 | primitiveId = 'c-' + constraint.id, 377 | sprite = constraint.layaSprite; 378 | 379 | // 如果sprite不存在,则初始化一个 380 | if (!sprite) 381 | sprite = constraint.layaSprite = new Laya.Sprite(); 382 | 383 | var primitive = sprite.graphics; 384 | 385 | // constraint 没有两个终点时不渲染 386 | if (!constraintRender.visible || !constraint.pointA || !constraint.pointB) 387 | { 388 | primitive.clear(); 389 | return; 390 | } 391 | 392 | // 如果sprite未在显示列表,则添加至显示列表 393 | if (!container.contains(sprite)) 394 | container.addChild(sprite); 395 | 396 | // 渲染 constraint 397 | primitive.clear(); 398 | 399 | var fromX, fromY, toX, toY; 400 | if (bodyA) 401 | { 402 | fromX = bodyA.position.x + pointA.x; 403 | fromY = bodyA.position.y + pointA.y; 404 | } 405 | else 406 | { 407 | fromX = pointA.x; 408 | fromY = pointA.y; 409 | } 410 | 411 | if (bodyB) 412 | { 413 | toX = bodyB.position.x + pointB.x; 414 | toY = bodyB.position.y + pointB.y; 415 | } 416 | else 417 | { 418 | toX = pointB.x; 419 | toY = pointB.y; 420 | } 421 | 422 | primitive.drawLine(fromX, fromY, toX, toY, constraintRender.strokeStyle, constraintRender.lineWidth); 423 | }; 424 | 425 | window.LayaRender = LayaRender; 426 | })(); -------------------------------------------------------------------------------- /bin/libs/laya.d3Plugin.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var Component3D=laya.d3.component.Component3D,MeshTerrainSprite3D=laya.d3.core.MeshTerrainSprite3D; 6 | var Sprite3D=laya.d3.core.Sprite3D; 7 | /** 8 | *PathFinding 类用于创建寻路。 9 | */ 10 | //class laya.d3.component.PathFind extends laya.d3.component.Component3D 11 | var PathFind=(function(_super){ 12 | function PathFind(){ 13 | this._meshTerrainSprite3D=null; 14 | this._finder=null; 15 | this._setting=null; 16 | this.grid=null; 17 | PathFind.__super.call(this); 18 | } 19 | 20 | __class(PathFind,'laya.d3.component.PathFind',_super); 21 | var __proto=PathFind.prototype; 22 | /** 23 | *@private 24 | *初始化载入蒙皮动画组件。 25 | *@param owner 所属精灵对象。 26 | */ 27 | __proto._load=function(owner){ 28 | if (! (owner instanceof laya.d3.core.MeshTerrainSprite3D )) 29 | throw new Error("PathFinding: The owner must MeshTerrainSprite3D!"); 30 | _super.prototype._load.call(this,owner); 31 | this._meshTerrainSprite3D=owner; 32 | } 33 | 34 | /** 35 | *寻找路径。 36 | *@param startX 开始X。 37 | *@param startZ 开始Z。 38 | *@param endX 结束X。 39 | *@param endZ 结束Z。 40 | *@return 路径。 41 | */ 42 | __proto.findPath=function(startX,startZ,endX,endZ){ 43 | var minX=this._meshTerrainSprite3D.minX; 44 | var minZ=this._meshTerrainSprite3D.minZ; 45 | var cellX=this._meshTerrainSprite3D.width / this.grid.width; 46 | var cellZ=this._meshTerrainSprite3D.depth / this.grid.height; 47 | var halfCellX=cellX / 2; 48 | var halfCellZ=cellZ / 2; 49 | var gridStartX=Math.floor((startX-minX)/ cellX); 50 | var gridStartZ=Math.floor((startZ-minZ)/ cellZ); 51 | var gridEndX=Math.floor((endX-minX)/ cellX); 52 | var gridEndZ=Math.floor((endZ-minZ)/ cellZ); 53 | var boundWidth=this.grid.width-1; 54 | var boundHeight=this.grid.height-1; 55 | (gridStartX > boundWidth)&& (gridStartX=boundWidth); 56 | (gridStartZ > boundHeight)&& (gridStartZ=boundHeight); 57 | (gridStartX < 0)&& (gridStartX=0); 58 | (gridStartZ < 0)&& (gridStartZ=0); 59 | (gridEndX > boundWidth)&& (gridEndX=boundWidth); 60 | (gridEndZ > boundHeight)&& (gridEndZ=boundHeight); 61 | (gridEndX < 0)&& (gridEndX=0); 62 | (gridEndZ < 0)&& (gridEndZ=0); 63 | var path=this._finder.findPath(gridStartX,gridStartZ,gridEndX,gridEndZ,this.grid); 64 | this.grid.reset(); 65 | for (var i=1;i < path.length-1;i++){ 66 | var gridPos=path[i]; 67 | gridPos[0]=gridPos[0] *cellX+halfCellX+minX; 68 | gridPos[1]=gridPos[1] *cellZ+halfCellZ+minZ; 69 | } 70 | if (path.length==1){ 71 | path[0][0]=endX; 72 | path[0][1]=endX; 73 | }else if (path.length > 1){ 74 | path[0][0]=startX; 75 | path[0][1]=startZ; 76 | path[path.length-1][0]=endX; 77 | path[path.length-1][1]=endZ; 78 | } 79 | return path; 80 | } 81 | 82 | /** 83 | *设置寻路设置。 84 | *@param value 寻路设置。 85 | */ 86 | /** 87 | *获取寻路设置。 88 | *@return 寻路设置。 89 | */ 90 | __getset(0,__proto,'setting',function(){ 91 | return this._setting; 92 | },function(value){ 93 | (value)&& (this._finder=new PathFinding.finders.AStarFinder(value)); 94 | this._setting=value; 95 | }); 96 | 97 | return PathFind; 98 | })(Component3D) 99 | 100 | 101 | 102 | })(window,document,Laya); 103 | -------------------------------------------------------------------------------- /bin/libs/laya.filter.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var BlendMode=laya.webgl.canvas.BlendMode,Browser=laya.utils.Browser,Color=laya.utils.Color,ColorFilterAction=laya.filters.ColorFilterAction; 6 | var ColorFilterActionGL=laya.filters.webgl.ColorFilterActionGL,Filter=laya.filters.Filter,FilterActionGL=laya.filters.webgl.FilterActionGL; 7 | var Matrix=laya.maths.Matrix,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,RenderContext=laya.renders.RenderContext; 8 | var RenderTarget2D=laya.webgl.resource.RenderTarget2D,RunDriver=laya.utils.RunDriver,ShaderDefines2D=laya.webgl.shader.d2.ShaderDefines2D; 9 | var Sprite=laya.display.Sprite,SubmitCMD=laya.webgl.submit.SubmitCMD,Texture=laya.resource.Texture,Value2D=laya.webgl.shader.d2.value.Value2D; 10 | /** 11 | *默认的FILTER,什么都不做 12 | *@private 13 | */ 14 | //class laya.filters.FilterAction 15 | var FilterAction=(function(){ 16 | function FilterAction(){ 17 | this.data=null; 18 | } 19 | 20 | __class(FilterAction,'laya.filters.FilterAction'); 21 | var __proto=FilterAction.prototype; 22 | Laya.imps(__proto,{"laya.filters.IFilterAction":true}) 23 | __proto.apply=function(data){ 24 | return null; 25 | } 26 | 27 | return FilterAction; 28 | })() 29 | 30 | 31 | /** 32 | *@private 33 | */ 34 | //class laya.filters.WebGLFilter 35 | var WebGLFilter=(function(){ 36 | function WebGLFilter(){}; 37 | __class(WebGLFilter,'laya.filters.WebGLFilter'); 38 | WebGLFilter.enable=function(){ 39 | if (WebGLFilter.isInit)return; 40 | WebGLFilter.isInit=true; 41 | if (!Render.isWebGL)return; 42 | RunDriver.createFilterAction=function (type){ 43 | var action; 44 | switch (type){ 45 | case /*laya.filters.Filter.COLOR*/0x20: 46 | action=new ColorFilterActionGL(); 47 | break ; 48 | case /*laya.filters.Filter.BLUR*/0x10: 49 | action=new BlurFilterActionGL(); 50 | break ; 51 | case /*laya.filters.Filter.GLOW*/0x08: 52 | action=new GlowFilterActionGL(); 53 | break ; 54 | } 55 | return action; 56 | } 57 | } 58 | 59 | WebGLFilter.isInit=false; 60 | WebGLFilter.__init$=function(){ 61 | BlurFilterActionGL; 62 | ColorFilterActionGL; 63 | GlowFilterActionGL; 64 | Render; 65 | RunDriver;{ 66 | RunDriver.createFilterAction=function (type){ 67 | var action; 68 | switch (type){ 69 | case /*laya.filters.Filter.BLUR*/0x10: 70 | action=new FilterAction(); 71 | break ; 72 | case /*laya.filters.Filter.GLOW*/0x08: 73 | action=new FilterAction(); 74 | break ; 75 | case /*laya.filters.Filter.COLOR*/0x20: 76 | action=new ColorFilterAction(); 77 | break ; 78 | } 79 | return action; 80 | } 81 | } 82 | } 83 | 84 | return WebGLFilter; 85 | })() 86 | 87 | 88 | /** 89 | *模糊滤镜 90 | */ 91 | //class laya.filters.BlurFilter extends laya.filters.Filter 92 | var BlurFilter=(function(_super){ 93 | function BlurFilter(strength){ 94 | this.strength=NaN; 95 | BlurFilter.__super.call(this); 96 | (strength===void 0)&& (strength=4); 97 | if (Render.isWebGL)WebGLFilter.enable(); 98 | this.strength=strength; 99 | this._action=RunDriver.createFilterAction(0x10); 100 | this._action.data=this; 101 | } 102 | 103 | __class(BlurFilter,'laya.filters.BlurFilter',_super); 104 | var __proto=BlurFilter.prototype; 105 | /** 106 | *@private 通知微端 107 | */ 108 | __proto.callNative=function(sp){ 109 | sp.conchModel &&sp.conchModel.blurFilter&&sp.conchModel.blurFilter(this.strength); 110 | } 111 | 112 | /** 113 | *@private 114 | *当前滤镜对应的操作器 115 | */ 116 | __getset(0,__proto,'action',function(){ 117 | return this._action; 118 | }); 119 | 120 | /** 121 | *@private 122 | *当前滤镜的类型 123 | */ 124 | __getset(0,__proto,'type',function(){ 125 | return 0x10; 126 | }); 127 | 128 | return BlurFilter; 129 | })(Filter) 130 | 131 | 132 | /** 133 | *发光滤镜(也可以当成阴影滤使用) 134 | */ 135 | //class laya.filters.GlowFilter extends laya.filters.Filter 136 | var GlowFilter=(function(_super){ 137 | function GlowFilter(color,blur,offX,offY){ 138 | this._color=null; 139 | GlowFilter.__super.call(this); 140 | this._elements=new Float32Array(9); 141 | (blur===void 0)&& (blur=4); 142 | (offX===void 0)&& (offX=6); 143 | (offY===void 0)&& (offY=6); 144 | if (Render.isWebGL){ 145 | WebGLFilter.enable(); 146 | } 147 | this._color=new Color(color); 148 | this.blur=Math.min(blur,20); 149 | this.offX=offX; 150 | this.offY=offY; 151 | this._action=RunDriver.createFilterAction(0x08); 152 | this._action.data=this; 153 | } 154 | 155 | __class(GlowFilter,'laya.filters.GlowFilter',_super); 156 | var __proto=GlowFilter.prototype; 157 | /**@private */ 158 | __proto.getColor=function(){ 159 | return this._color._color; 160 | } 161 | 162 | /** 163 | *@private 通知微端 164 | */ 165 | __proto.callNative=function(sp){ 166 | sp.conchModel &&sp.conchModel.glowFilter&&sp.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6]); 167 | } 168 | 169 | /** 170 | *@private 171 | *滤镜类型 172 | */ 173 | __getset(0,__proto,'type',function(){ 174 | return 0x08; 175 | }); 176 | 177 | /**@private */ 178 | __getset(0,__proto,'action',function(){ 179 | return this._action; 180 | }); 181 | 182 | /**@private */ 183 | /**@private */ 184 | __getset(0,__proto,'offY',function(){ 185 | return this._elements[6]; 186 | },function(value){ 187 | this._elements[6]=value; 188 | }); 189 | 190 | /**@private */ 191 | /**@private */ 192 | __getset(0,__proto,'offX',function(){ 193 | return this._elements[5]; 194 | },function(value){ 195 | this._elements[5]=value; 196 | }); 197 | 198 | /**@private */ 199 | /**@private */ 200 | __getset(0,__proto,'blur',function(){ 201 | return this._elements[4]; 202 | },function(value){ 203 | this._elements[4]=value; 204 | }); 205 | 206 | return GlowFilter; 207 | })(Filter) 208 | 209 | 210 | /** 211 | *@private 212 | */ 213 | //class laya.filters.webgl.BlurFilterActionGL extends laya.filters.webgl.FilterActionGL 214 | var BlurFilterActionGL=(function(_super){ 215 | function BlurFilterActionGL(){ 216 | this.data=null; 217 | BlurFilterActionGL.__super.call(this); 218 | } 219 | 220 | __class(BlurFilterActionGL,'laya.filters.webgl.BlurFilterActionGL',_super); 221 | var __proto=BlurFilterActionGL.prototype; 222 | __proto.setValueMix=function(shader){ 223 | shader.defines.add(this.data.type); 224 | var o=shader; 225 | } 226 | 227 | __proto.apply3d=function(scope,sprite,context,x,y){ 228 | var b=scope.getValue("bounds"); 229 | var shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 230 | shaderValue.setFilters([this.data]); 231 | var tMatrix=Matrix.EMPTY; 232 | tMatrix.identity(); 233 | context.ctx.drawTarget(scope,0,0,b.width,b.height,Matrix.EMPTY,"src",shaderValue); 234 | shaderValue.setFilters(null); 235 | } 236 | 237 | __proto.setValue=function(shader){ 238 | shader.strength=this.data.strength; 239 | } 240 | 241 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.BLUR*/0x10;}); 242 | return BlurFilterActionGL; 243 | })(FilterActionGL) 244 | 245 | 246 | /** 247 | *@private 248 | */ 249 | //class laya.filters.webgl.GlowFilterActionGL extends laya.filters.webgl.FilterActionGL 250 | var GlowFilterActionGL=(function(_super){ 251 | function GlowFilterActionGL(){ 252 | this.data=null; 253 | this._initKey=false; 254 | this._textureWidth=0; 255 | this._textureHeight=0; 256 | GlowFilterActionGL.__super.call(this); 257 | } 258 | 259 | __class(GlowFilterActionGL,'laya.filters.webgl.GlowFilterActionGL',_super); 260 | var __proto=GlowFilterActionGL.prototype; 261 | Laya.imps(__proto,{"laya.filters.IFilterActionGL":true}) 262 | __proto.setValueMix=function(shader){} 263 | __proto.apply3d=function(scope,sprite,context,x,y){ 264 | var b=scope.getValue("bounds"); 265 | scope.addValue("color",this.data.getColor()); 266 | var w=b.width,h=b.height; 267 | this._textureWidth=w; 268 | this._textureHeight=h; 269 | var submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.tmpTarget); 270 | context.ctx.addRenderObject(submit); 271 | var shaderValue; 272 | var mat=Matrix.TEMP; 273 | mat.identity(); 274 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 275 | shaderValue.setFilters([this.data]); 276 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue,null,BlendMode.TOINT.overlay); 277 | submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.startOut); 278 | context.ctx.addRenderObject(submit); 279 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 280 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"tmpTarget",shaderValue,Texture.INV_UV,BlendMode.TOINT.overlay); 281 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 282 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue); 283 | submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.recycleTarget); 284 | context.ctx.addRenderObject(submit); 285 | return null; 286 | } 287 | 288 | __proto.setSpriteWH=function(sprite){ 289 | this._textureWidth=sprite.width; 290 | this._textureHeight=sprite.height; 291 | } 292 | 293 | __proto.setValue=function(shader){ 294 | shader.u_offsetX=this.data.offX; 295 | shader.u_offsetY=-this.data.offY; 296 | shader.u_strength=1.0; 297 | shader.u_blurX=this.data.blur; 298 | shader.u_blurY=this.data.blur; 299 | shader.u_textW=this._textureWidth; 300 | shader.u_textH=this._textureHeight; 301 | shader.u_color=this.data.getColor(); 302 | } 303 | 304 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.GLOW*/0x08;}); 305 | GlowFilterActionGL.tmpTarget=function(scope,sprite,context,x,y){ 306 | var b=scope.getValue("bounds"); 307 | var out=scope.getValue("out"); 308 | out.end(); 309 | var tmpTarget=RenderTarget2D.create(b.width,b.height); 310 | tmpTarget.start(); 311 | var color=scope.getValue("color"); 312 | if (color){ 313 | tmpTarget.clear(color[0],color[1],color[2],0); 314 | } 315 | scope.addValue("tmpTarget",tmpTarget); 316 | } 317 | 318 | GlowFilterActionGL.startOut=function(scope,sprite,context,x,y){ 319 | var tmpTarget=scope.getValue("tmpTarget"); 320 | tmpTarget.end(); 321 | var out=scope.getValue("out"); 322 | out.start(); 323 | var color=scope.getValue("color"); 324 | if (color){ 325 | out.clear(color[0],color[1],color[2],0); 326 | } 327 | } 328 | 329 | GlowFilterActionGL.recycleTarget=function(scope,sprite,context,x,y){ 330 | var src=scope.getValue("src"); 331 | var tmpTarget=scope.getValue("tmpTarget"); 332 | tmpTarget.recycle(); 333 | } 334 | 335 | return GlowFilterActionGL; 336 | })(FilterActionGL) 337 | 338 | 339 | Laya.__init([WebGLFilter]); 340 | })(window,document,Laya); 341 | -------------------------------------------------------------------------------- /bin/libs/min/laya.d3Plugin.min.js: -------------------------------------------------------------------------------- 1 | !function(t,i,e){var n=(e.un,e.uns,e.static,e.class),r=e.getset,h=(e.__newvec,laya.d3.component.Component3D);laya.d3.core.MeshTerrainSprite3D,laya.d3.core.Sprite3D,function(t){function i(){this._meshTerrainSprite3D=null,this._finder=null,this._setting=null,this.grid=null,i.__super.call(this)}n(i,"laya.d3.component.PathFind",t);var e=i.prototype;e._load=function(i){if(!(i instanceof laya.d3.core.MeshTerrainSprite3D))throw new Error("PathFinding: The owner must MeshTerrainSprite3D!");t.prototype._load.call(this,i),this._meshTerrainSprite3D=i},e.findPath=function(t,i,e,n){var r=this._meshTerrainSprite3D.minX,h=this._meshTerrainSprite3D.minZ,a=this._meshTerrainSprite3D.width/this.grid.width,s=this._meshTerrainSprite3D.depth/this.grid.height,o=a/2,d=s/2,l=Math.floor((t-r)/a),g=Math.floor((i-h)/s),f=Math.floor((e-r)/a),c=Math.floor((n-h)/s),p=this.grid.width-1,u=this.grid.height-1;l>p&&(l=p),g>u&&(g=u),l<0&&(l=0),g<0&&(g=0),f>p&&(f=p),c>u&&(c=u),f<0&&(f=0),c<0&&(c=0);var _=this._finder.findPath(l,g,f,c,this.grid);this.grid.reset();for(var m=1;m<_.length-1;m++){var D=_[m];D[0]=D[0]*a+o+r,D[1]=D[1]*s+d+h}return 1==_.length?(_[0][0]=e,_[0][1]=e):_.length>1&&(_[0][0]=t,_[0][1]=i,_[_.length-1][0]=e,_[_.length-1][1]=n),_},r(0,e,"setting",function(){return this._setting},function(t){t&&(this._finder=new PathFinding.finders.AStarFinder(t)),this._setting=t}),i}(h)}(window,document,Laya); -------------------------------------------------------------------------------- /bin/libs/min/laya.filter.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e,i){var r=(i.un,i.uns,i.static,i.class),a=i.getset,n=(i.__newvec,laya.webgl.canvas.BlendMode),l=(laya.utils.Browser,laya.utils.Color),s=laya.filters.ColorFilterAction,o=laya.filters.webgl.ColorFilterActionGL,u=laya.filters.Filter,c=laya.filters.webgl.FilterActionGL,h=laya.maths.Matrix,d=(laya.maths.Rectangle,laya.renders.Render),f=(laya.renders.RenderContext,laya.webgl.resource.RenderTarget2D),_=laya.utils.RunDriver,g=(laya.webgl.shader.d2.ShaderDefines2D,laya.display.Sprite,laya.webgl.submit.SubmitCMD),y=laya.resource.Texture,b=laya.webgl.shader.d2.value.Value2D,p=function(){function t(){this.data=null}r(t,"laya.filters.FilterAction");var e=t.prototype;return i.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){return null},t}(),w=function(){function t(){}return r(t,"laya.filters.WebGLFilter"),t.enable=function(){t.isInit||(t.isInit=!0,d.isWebGL&&(_.createFilterAction=function(t){var e;switch(t){case 32:e=new o;break;case 16:e=new v;break;case 8:e=new x}return e}))},t.isInit=!1,t.__init$=function(){_.createFilterAction=function(t){var e;switch(t){case 16:e=new p;break;case 8:e=new p;break;case 32:e=new s}return e}},t}(),v=(function(t){function e(t){this.strength=NaN,e.__super.call(this),void 0===t&&(t=4),d.isWebGL&&w.enable(),this.strength=t,this._action=_.createFilterAction(16),this._action.data=this}r(e,"laya.filters.BlurFilter",t);var i=e.prototype;i.callNative=function(t){t.conchModel&&t.conchModel.blurFilter&&t.conchModel.blurFilter(this.strength)},a(0,i,"action",function(){return this._action}),a(0,i,"type",function(){return 16}),e}(u),function(t){function e(t,i,r,a){this._color=null,e.__super.call(this),this._elements=new Float32Array(9),void 0===i&&(i=4),void 0===r&&(r=6),void 0===a&&(a=6),d.isWebGL&&w.enable(),this._color=new l(t),this.blur=Math.min(i,20),this.offX=r,this.offY=a,this._action=_.createFilterAction(8),this._action.data=this}r(e,"laya.filters.GlowFilter",t);var i=e.prototype;i.getColor=function(){return this._color._color},i.callNative=function(t){t.conchModel&&t.conchModel.glowFilter&&t.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6])},a(0,i,"type",function(){return 8}),a(0,i,"action",function(){return this._action}),a(0,i,"offY",function(){return this._elements[6]},function(t){this._elements[6]=t}),a(0,i,"offX",function(){return this._elements[5]},function(t){this._elements[5]=t}),a(0,i,"blur",function(){return this._elements[4]},function(t){this._elements[4]=t}),e}(u),function(t){function e(){this.data=null,e.__super.call(this)}r(e,"laya.filters.webgl.BlurFilterActionGL",t);var i=e.prototype;return i.setValueMix=function(t){t.defines.add(this.data.type)},i.apply3d=function(t,e,i,r,a){var n=t.getValue("bounds"),l=b.create(1,0);l.setFilters([this.data]),h.EMPTY.identity(),i.ctx.drawTarget(t,0,0,n.width,n.height,h.EMPTY,"src",l),l.setFilters(null)},i.setValue=function(t){t.strength=this.data.strength},a(0,i,"typeMix",function(){return 16}),e}(c)),x=function(t){function e(){this.data=null,this._initKey=!1,this._textureWidth=0,this._textureHeight=0,e.__super.call(this)}r(e,"laya.filters.webgl.GlowFilterActionGL",t);var l=e.prototype;return i.imps(l,{"laya.filters.IFilterActionGL":!0}),l.setValueMix=function(t){},l.apply3d=function(t,i,r,a,l){var s=t.getValue("bounds");t.addValue("color",this.data.getColor());var o=s.width,u=s.height;this._textureWidth=o,this._textureHeight=u;var c=g.create([t,i,r,0,0],e.tmpTarget);r.ctx.addRenderObject(c);var d,f=h.TEMP;return f.identity(),d=b.create(1,0),d.setFilters([this.data]),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"src",d,null,n.TOINT.overlay),c=g.create([t,i,r,0,0],e.startOut),r.ctx.addRenderObject(c),d=b.create(1,0),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"tmpTarget",d,y.INV_UV,n.TOINT.overlay),d=b.create(1,0),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"src",d),c=g.create([t,i,r,0,0],e.recycleTarget),r.ctx.addRenderObject(c),null},l.setSpriteWH=function(t){this._textureWidth=t.width,this._textureHeight=t.height},l.setValue=function(t){t.u_offsetX=this.data.offX,t.u_offsetY=-this.data.offY,t.u_strength=1,t.u_blurX=this.data.blur,t.u_blurY=this.data.blur,t.u_textW=this._textureWidth,t.u_textH=this._textureHeight,t.u_color=this.data.getColor()},a(0,l,"typeMix",function(){return 8}),e.tmpTarget=function(t,e,i,r,a){var n=t.getValue("bounds");t.getValue("out").end();var l=f.create(n.width,n.height);l.start();var s=t.getValue("color");s&&l.clear(s[0],s[1],s[2],0),t.addValue("tmpTarget",l)},e.startOut=function(t,e,i,r,a){t.getValue("tmpTarget").end();var n=t.getValue("out");n.start();var l=t.getValue("color");l&&n.clear(l[0],l[1],l[2],0)},e.recycleTarget=function(t,e,i,r,a){t.getValue("src");t.getValue("tmpTarget").recycle()},e}(c);i.__init([w])}(window,document,Laya); -------------------------------------------------------------------------------- /bin/res/BackGround.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/BackGround.png -------------------------------------------------------------------------------- /bin/res/BackGround.png.bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/BackGround.png.bak.png -------------------------------------------------------------------------------- /bin/res/atlas/.rec: -------------------------------------------------------------------------------- 1 | D . 2 | D comp 3 | P D12221A9 bg.png 4 | P 9401CC40 blank.png 5 | P B03390E5 btn_close.png 6 | P 1F3929EA button.png 7 | P 6CC6DF97 checkbox.png 8 | P FB94CCF2 clip_num.png 9 | P F7B6B7D7 clip_selectBox.png 10 | P 755271AE clip_tree_arrow.png 11 | P 859FD34C clip_tree_folder.png 12 | P A0E3B8F9 combobox.png 13 | P 9EDA959E hscroll$bar.png 14 | P 1AB768D4 hscroll$down.png 15 | P 685261D3 hscroll$up.png 16 | P 274B8076 hscroll.png 17 | P E466EB1C hslider$bar.png 18 | P C4BECA54 hslider.png 19 | P 5EDC128C html.png 20 | P ACFFCCCF image.png 21 | P 5EDC128C label.png 22 | P 5EDC128C linkbutton.png 23 | P 9E4DD730 progress$bar.png 24 | P 3FD78E12 progress.png 25 | P BF898D6A radio.png 26 | P BF898D6A radiogroup.png 27 | P 8CFD9D35 tab.png 28 | P BDA71F88 textarea.png 29 | P BDA71F88 textinput.png 30 | P 52107B89 vscroll$bar.png 31 | P E26B933E vscroll$down.png 32 | P B9680947 vscroll$up.png 33 | P 7E990267 vscroll.png 34 | P E466EB1C vslider$bar.png 35 | P 2BFF7046 vslider.png 36 | -------------------------------------------------------------------------------- /bin/res/atlas/comp.atlas: -------------------------------------------------------------------------------- 1 | {"frames":{"image.png":{"frame":{"x":0,"y":0,"w":150,"h":250,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":150,"h":250}},"bg.png":{"frame":{"x":152,"y":0,"w":100,"h":79,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":79}},"clip_num.png":{"frame":{"x":0,"y":252,"w":240,"h":27,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":240,"h":27}},"combobox.png":{"frame":{"x":152,"y":81,"w":91,"h":69,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":69}},"tab.png":{"frame":{"x":242,"y":152,"w":70,"h":78,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":70,"h":78}},"button.png":{"frame":{"x":152,"y":152,"w":75,"h":69,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":75,"h":69}},"clip_selectBox.png":{"frame":{"x":245,"y":81,"w":100,"h":40,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":40}},"html.png":{"frame":{"x":245,"y":123,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"label.png":{"frame":{"x":152,"y":232,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"linkbutton.png":{"frame":{"x":242,"y":252,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"textarea.png":{"frame":{"x":242,"y":272,"w":91,"h":23,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":23}},"textinput.png":{"frame":{"x":254,"y":0,"w":91,"h":23,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":23}},"btn_close.png":{"frame":{"x":335,"y":272,"w":28,"h":60,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":28,"h":60}},"hscroll$bar.png":{"frame":{"x":314,"y":143,"w":21,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":21,"h":51}},"vscroll$bar.png":{"frame":{"x":337,"y":143,"w":17,"h":63,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":63}},"hscroll$down.png":{"frame":{"x":314,"y":196,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"hscroll$up.png":{"frame":{"x":347,"y":0,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"vscroll$down.png":{"frame":{"x":347,"y":53,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"vscroll$up.png":{"frame":{"x":254,"y":25,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"clip_tree_folder.png":{"frame":{"x":273,"y":25,"w":16,"h":48,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":16,"h":48}},"progress$bar.png":{"frame":{"x":291,"y":25,"w":50,"h":14,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":50,"h":14}},"progress.png":{"frame":{"x":291,"y":41,"w":50,"h":14,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":50,"h":14}},"hslider.png":{"frame":{"x":0,"y":281,"w":100,"h":6,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":6}},"vslider.png":{"frame":{"x":356,"y":143,"w":6,"h":100,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":6,"h":100}},"checkbox.png":{"frame":{"x":333,"y":208,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"radio.png":{"frame":{"x":102,"y":281,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"radiogroup.png":{"frame":{"x":0,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"hslider$bar.png":{"frame":{"x":16,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"vslider$bar.png":{"frame":{"x":32,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"hscroll.png":{"frame":{"x":274,"y":232,"w":33,"h":17,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":33,"h":17}},"vscroll.png":{"frame":{"x":48,"y":289,"w":17,"h":33,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":33}},"clip_tree_arrow.png":{"frame":{"x":67,"y":289,"w":14,"h":28,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":28}},"blank.png":{"frame":{"x":347,"y":106,"w":10,"h":10,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":10,"h":10}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"comp.png","prefix":"comp\/","md5":"054dc388a3e4a50802406d800fb20f7d"}} 2 | -------------------------------------------------------------------------------- /bin/res/atlas/comp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/atlas/comp.png -------------------------------------------------------------------------------- /bin/res/atlas/rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/atlas/rec -------------------------------------------------------------------------------- /bin/res/bird/bird_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/bird/bird_1.png -------------------------------------------------------------------------------- /bin/res/bird/bird_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/bird/bird_2.png -------------------------------------------------------------------------------- /bin/res/bird/bird_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/bird/bird_3.png -------------------------------------------------------------------------------- /bin/res/bird/bird_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/bird/bird_4.png -------------------------------------------------------------------------------- /bin/res/cat_sleep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/cat_sleep.png -------------------------------------------------------------------------------- /bin/res/effect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/effect.png -------------------------------------------------------------------------------- /bin/res/floor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/floor.png -------------------------------------------------------------------------------- /bin/res/hp/en_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/hp/en_bar.png -------------------------------------------------------------------------------- /bin/res/hp/hp_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/hp/hp_bar.png -------------------------------------------------------------------------------- /bin/res/hp/hp_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/hp/hp_bg.png -------------------------------------------------------------------------------- /bin/res/item/item_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/item/item_1.png -------------------------------------------------------------------------------- /bin/res/item/item_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/item/item_2.png -------------------------------------------------------------------------------- /bin/res/item/item_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/item/item_3.png -------------------------------------------------------------------------------- /bin/res/item/item_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/item/item_4.png -------------------------------------------------------------------------------- /bin/res/m_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/m_background.png -------------------------------------------------------------------------------- /bin/res/particle/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/particle/heart.png -------------------------------------------------------------------------------- /bin/res/particle/particle.part: -------------------------------------------------------------------------------- 1 | { 2 | "textureName":"res/particle/heart.png", 3 | "textureCount":1, 4 | "useEndRadian":true, 5 | "positionVariance":{ 6 | "2":0, 7 | "1":2, 8 | "0":2 9 | }, 10 | "minVerticalVelocity":0.1, 11 | "minVerticalStartRadian":-0, 12 | "minVerticalEndRadian":-6.283185307179586, 13 | "minStartSize":10, 14 | "minStartRadius":96, 15 | "minRotateSpeed":-2, 16 | "minHorizontalVelocity":0.1, 17 | "minHorizontalStartRadian":-0, 18 | "minHorizontalEndRadian":-6.283185307179586, 19 | "minEndSize":12, 20 | "minEndRadius":96, 21 | "minStartColor":{ 22 | "3":0.6000000238418579, 23 | "2":1, 24 | "1":0.30000001192092896, 25 | "0":1 26 | }, 27 | "minEndColor":{ 28 | "3":1, 29 | "2":1, 30 | "1":0, 31 | "0":0 32 | }, 33 | "maxVerticalVelocity":0.1, 34 | "maxVerticalStartRadian":0, 35 | "maxVerticalEndRadian":6.283185307179586, 36 | "maxStartSize":20, 37 | "maxStartRadius":96, 38 | "maxRotateSpeed":2, 39 | "maxPartices":1600, 40 | "maxHorizontalVelocity":0.1, 41 | "maxHorizontalStartRadian":0, 42 | "maxHorizontalEndRadian":6.283185307179586, 43 | "maxEndSize":40, 44 | "maxEndRadius":96, 45 | "maxStartColor":{ 46 | "3":1, 47 | "2":0, 48 | "1":0.30000001192092896, 49 | "0":1 50 | }, 51 | "maxEndColor":{ 52 | "3":1, 53 | "2":1, 54 | "1":0, 55 | "0":0 56 | }, 57 | "gravity":{ 58 | "2":0, 59 | "1":2, 60 | "0":0 61 | }, 62 | "endVelocity":1, 63 | "emitterVelocitySensitivity":1, 64 | "duration":6, 65 | "colorComponentInter":true, 66 | "blendState":1, 67 | "ageAddScale":1 68 | } -------------------------------------------------------------------------------- /bin/res/player.atlas: -------------------------------------------------------------------------------- 1 | {"frames":{"chara_01.png":{"frame":{"x":0,"y":0,"w":45,"h":71,"idx":0},"spriteSourceSize":{"x":27,"y":23},"sourceSize":{"w":96,"h":96}},"chara_02.png":{"frame":{"x":47,"y":0,"w":52,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_03.png":{"frame":{"x":0,"y":73,"w":44,"h":73,"idx":0},"spriteSourceSize":{"x":28,"y":21},"sourceSize":{"w":96,"h":96}},"chara_04.png":{"frame":{"x":101,"y":0,"w":50,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_05.png":{"frame":{"x":46,"y":73,"w":53,"h":61,"idx":0},"spriteSourceSize":{"x":22,"y":16},"sourceSize":{"w":96,"h":96}},"chara_06.png":{"frame":{"x":153,"y":0,"w":52,"h":61,"idx":0},"spriteSourceSize":{"x":23,"y":16},"sourceSize":{"w":96,"h":96}},"chara_07.png":{"frame":{"x":207,"y":0,"w":54,"h":60,"idx":0},"spriteSourceSize":{"x":21,"y":17},"sourceSize":{"w":96,"h":96}},"chara_08.png":{"frame":{"x":101,"y":73,"w":54,"h":61,"idx":0},"spriteSourceSize":{"x":21,"y":16},"sourceSize":{"w":96,"h":96}},"chara_09.png":{"frame":{"x":0,"y":148,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":13},"sourceSize":{"w":96,"h":96}},"chara_10.png":{"frame":{"x":67,"y":136,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":21,"y":12},"sourceSize":{"w":96,"h":96}},"chara_11.png":{"frame":{"x":157,"y":63,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":11},"sourceSize":{"w":96,"h":96}},"chara_12.png":{"frame":{"x":224,"y":62,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":18,"y":13},"sourceSize":{"w":96,"h":96}},"chara_13.png":{"frame":{"x":127,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_14.png":{"frame":{"x":181,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_15.png":{"frame":{"x":235,"y":139,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_16.png":{"frame":{"x":235,"y":205,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"player.png","prefix":"","md5":"6cecff3fca089fbffaec581fc54f47fc"}} 2 | -------------------------------------------------------------------------------- /bin/res/player.json: -------------------------------------------------------------------------------- 1 | {"frames":{"chara_01.png":{"frame":{"x":0,"y":0,"w":45,"h":71,"idx":0},"spriteSourceSize":{"x":27,"y":23},"sourceSize":{"w":96,"h":96}},"chara_02.png":{"frame":{"x":47,"y":0,"w":52,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_03.png":{"frame":{"x":0,"y":73,"w":44,"h":73,"idx":0},"spriteSourceSize":{"x":28,"y":21},"sourceSize":{"w":96,"h":96}},"chara_04.png":{"frame":{"x":101,"y":0,"w":50,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_05.png":{"frame":{"x":46,"y":73,"w":53,"h":61,"idx":0},"spriteSourceSize":{"x":22,"y":16},"sourceSize":{"w":96,"h":96}},"chara_06.png":{"frame":{"x":153,"y":0,"w":52,"h":61,"idx":0},"spriteSourceSize":{"x":23,"y":16},"sourceSize":{"w":96,"h":96}},"chara_07.png":{"frame":{"x":207,"y":0,"w":54,"h":60,"idx":0},"spriteSourceSize":{"x":21,"y":17},"sourceSize":{"w":96,"h":96}},"chara_08.png":{"frame":{"x":101,"y":73,"w":54,"h":61,"idx":0},"spriteSourceSize":{"x":21,"y":16},"sourceSize":{"w":96,"h":96}},"chara_09.png":{"frame":{"x":0,"y":148,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":13},"sourceSize":{"w":96,"h":96}},"chara_10.png":{"frame":{"x":67,"y":136,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":21,"y":12},"sourceSize":{"w":96,"h":96}},"chara_11.png":{"frame":{"x":157,"y":63,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":11},"sourceSize":{"w":96,"h":96}},"chara_12.png":{"frame":{"x":224,"y":62,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":18,"y":13},"sourceSize":{"w":96,"h":96}},"chara_13.png":{"frame":{"x":127,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_14.png":{"frame":{"x":181,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_15.png":{"frame":{"x":235,"y":139,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_16.png":{"frame":{"x":235,"y":205,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"player.png","prefix":"","md5":"6cecff3fca089fbffaec581fc54f47fc"}} 2 | -------------------------------------------------------------------------------- /bin/res/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player.png -------------------------------------------------------------------------------- /bin/res/player/chara_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_01.png -------------------------------------------------------------------------------- /bin/res/player/chara_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_02.png -------------------------------------------------------------------------------- /bin/res/player/chara_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_03.png -------------------------------------------------------------------------------- /bin/res/player/chara_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_04.png -------------------------------------------------------------------------------- /bin/res/player/chara_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_05.png -------------------------------------------------------------------------------- /bin/res/player/chara_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_06.png -------------------------------------------------------------------------------- /bin/res/player/chara_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_07.png -------------------------------------------------------------------------------- /bin/res/player/chara_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_08.png -------------------------------------------------------------------------------- /bin/res/player/chara_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_09.png -------------------------------------------------------------------------------- /bin/res/player/chara_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_10.png -------------------------------------------------------------------------------- /bin/res/player/chara_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_11.png -------------------------------------------------------------------------------- /bin/res/player/chara_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_12.png -------------------------------------------------------------------------------- /bin/res/player/chara_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_13.png -------------------------------------------------------------------------------- /bin/res/player/chara_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_14.png -------------------------------------------------------------------------------- /bin/res/player/chara_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_15.png -------------------------------------------------------------------------------- /bin/res/player/chara_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/player/chara_16.png -------------------------------------------------------------------------------- /bin/res/rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/rec -------------------------------------------------------------------------------- /bin/res/spiritEffect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/spiritEffect.png -------------------------------------------------------------------------------- /bin/res/tree0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/tree0.png -------------------------------------------------------------------------------- /bin/res/wav/BG.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/BG.wav -------------------------------------------------------------------------------- /bin/res/wav/DecelerationCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/DecelerationCounting.wav -------------------------------------------------------------------------------- /bin/res/wav/InvincibleCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/InvincibleCounting.wav -------------------------------------------------------------------------------- /bin/res/wav/Invincible_end.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/Invincible_end.wav -------------------------------------------------------------------------------- /bin/res/wav/Invincible_start.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/Invincible_start.wav -------------------------------------------------------------------------------- /bin/res/wav/LowerSpeed.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/LowerSpeed.wav -------------------------------------------------------------------------------- /bin/res/wav/StarCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/bin/res/wav/StarCounting.wav -------------------------------------------------------------------------------- /bin/unpack.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=759670 3 | // for the documentation about the jsconfig.json format 4 | "compilerOptions": { 5 | "target": "es5" 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | "bower_components", 10 | "jspm_packages", 11 | "tmp", 12 | "temp", 13 | "bin" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /laya/.laya: -------------------------------------------------------------------------------- 1 | 2 | img,temp,sound 3 | embed 4 | png,jpg 5 | bin/res/atlas 6 | bin 7 | src/ui 8 | 9 | 11 | 0 12 | bin/ui.json 13 | Box,List,Tab,RadioGroup,ViewStack,Panel,HBox,VBox,Tree,Sprite 14 | View,Dialog 15 | 16 | 2 17 | 18 | 80 19 | 20 | 21 | 23 | 2048 24 | 2048 25 | 512 26 | 512 27 | false 28 | false 29 | -------------------------------------------------------------------------------- /laya/assets/comp/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/bg.png -------------------------------------------------------------------------------- /laya/assets/comp/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/blank.png -------------------------------------------------------------------------------- /laya/assets/comp/btn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/btn_close.png -------------------------------------------------------------------------------- /laya/assets/comp/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/button.png -------------------------------------------------------------------------------- /laya/assets/comp/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/checkbox.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_num.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/clip_num.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_selectBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/clip_selectBox.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_tree_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/clip_tree_arrow.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_tree_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/clip_tree_folder.png -------------------------------------------------------------------------------- /laya/assets/comp/combobox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/combobox.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hscroll$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hscroll$down.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hscroll$up.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hscroll.png -------------------------------------------------------------------------------- /laya/assets/comp/hslider$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hslider$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/hslider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/hslider.png -------------------------------------------------------------------------------- /laya/assets/comp/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/html.png -------------------------------------------------------------------------------- /laya/assets/comp/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/image.png -------------------------------------------------------------------------------- /laya/assets/comp/label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/label.png -------------------------------------------------------------------------------- /laya/assets/comp/linkbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/linkbutton.png -------------------------------------------------------------------------------- /laya/assets/comp/progress$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/progress$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/progress.png -------------------------------------------------------------------------------- /laya/assets/comp/radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/radio.png -------------------------------------------------------------------------------- /laya/assets/comp/radiogroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/radiogroup.png -------------------------------------------------------------------------------- /laya/assets/comp/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/tab.png -------------------------------------------------------------------------------- /laya/assets/comp/textarea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/textarea.png -------------------------------------------------------------------------------- /laya/assets/comp/textinput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/textinput.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vscroll$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vscroll$down.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vscroll$up.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vscroll.png -------------------------------------------------------------------------------- /laya/assets/comp/vslider$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vslider$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/vslider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/laya/assets/comp/vslider.png -------------------------------------------------------------------------------- /rec.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/rec.mp4 -------------------------------------------------------------------------------- /release/layaweb/1.0.0/apk/洛洛地平线.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/apk/洛洛地平线.apk -------------------------------------------------------------------------------- /release/layaweb/1.0.0/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 洛洛地平线 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/Config.js: -------------------------------------------------------------------------------- 1 | //定义背景的大小 2 | var BG_WIDTH = 800; 3 | var BG_HEIGHT = 480; 4 | //地板大小 5 | var FLOOR_HEIGHT = 84; 6 | var FLOOR_WIDTH = 960; 7 | //人物大小 8 | var PLAYER_WIDTH = 96; 9 | var PLAYER_HEIGHT = 96; 10 | //能量条背景大小 11 | var ENERGY_BG_BAR_WIDTH = 180; 12 | var ENERGY_BG_BAR_HEIGHT = 21; 13 | //能量条大小 14 | var ENERGY_BAR_WIDTH = 155; 15 | var ENERGY_BAR_HEIGHT = 12; 16 | //物品-星星大小 17 | var ITEM_STAR_WIDTH = 32; 18 | var ITEM_STAR_HEIGHT = 32; 19 | //物品-星星出现几率 20 | var ITEM_STAR_PROBABILITY = 0.8; 21 | //物品-减速道具大小 22 | var ITEM_DECELERATION_WIDTH = 40; 23 | var ITEM_DECELERATION_HEIGHT = 53; 24 | //物品-减速道具出现几率 25 | var ITEM_DECELERAYION_PROBABILITY = 0.1; 26 | //物品-无敌道具大小 27 | var ITEM_INVINCIBLE_WIDTH = 40; 28 | var ITEM_INVINCIBLE_HEIGHT = 48; 29 | //物品-无敌道具出现几率 30 | var ITEM_INVINCIBLE_PROBABILITY = 0.08; 31 | 32 | //npc大小 33 | var NPC_BIRD_WIDTH = 96; 34 | var NPC_BIRD_HEIGHT = 96; 35 | //NPC出现几率 36 | var NPC_BIRD_PROBABLITY = 0.1; 37 | //npc间隔 38 | var NPC_BIRD_INTANCE = 200; 39 | 40 | //无敌状态下能量条下降速度 41 | var ITEM_INVINCIBLE_DESCENT_SPEED = 0.20; 42 | //减速能量条下降速度 43 | var ITEM_DECELERATION_DESCENT_SPEED = 0.8; 44 | 45 | //背景移动速度 46 | var BG_SPEED = 3; 47 | //背景的帧处理间隔 48 | var BG_FRAME_DELAY = 1; 49 | 50 | //人物的奔跑速度设置是在地板移动速度那里. 51 | //人物帧处理间隔 52 | var PLAYER_FRAME_DELAY = 1; 53 | //人物奔跑频率,值越大看起来越慢 54 | var PLAYER_RUN_SPEED_DEFAULT = 190; 55 | var PLAYER_RUN_SPEED = PLAYER_RUN_SPEED_DEFAULT; 56 | //人物下落初始变量 57 | var PLAYER_DOWN_VY = 0; 58 | //人物下落速度 59 | var PLAYER_DOWN_SPEED = 2; 60 | //人物最大下落值 61 | var PLAYER_DOWN_MAX_SPEED = 32; 62 | 63 | //Npc播放频率,值越大看起来越慢 64 | var NPC_BIRD_INTERVAL = 100; 65 | 66 | //地板移动速度 67 | var FLOOR_SPEED_DEFAULT = 3.2; 68 | var FLOOR_SPEED = 3.2; 69 | var FLOOR_SPEED_MAX = 10; 70 | var FLOOR_SPEED_FASTER_STEP = 0.001; 71 | var IS_FLOOR_SPEED_MAX = false; 72 | //地板的帧处理间隔 73 | var FLOOR_FRAME_DELAY = 1; 74 | 75 | //地板管理器的帧处理间隔 76 | var MAP_FLOOR_FRAME_DELAY = 10; 77 | 78 | //能量条最小值 79 | var ENERGY_BAR_MIN_VALUE = 0; 80 | //能量条最大值 81 | var ENERGY_BAR_MAX_VALUE = 100; 82 | //能量条背景位置 83 | var ENERGY_BAR_X = 15; 84 | var ENERGY_BAR_Y = 2; 85 | 86 | //物品出现在地板上的间隔 87 | var ITEMNUM_ON_FLOOR = 2; 88 | //NPC在地板上出现的间隔 89 | var NPC_BIRD_NUM_ON_FLOOR = 2; 90 | 91 | //分数栏 92 | var SCORETEXT_COLOR = "#FFFFFF";//颜色 93 | var SCORETEXT_FONT_SIZE = 30;//字体大小 94 | var SCORETEXT_TEXT_DEFAULT = 0;//默认文字 95 | var SCORETEXT_ALIGN = "right";// "left": 居左对齐显示。 "center": 居中对齐显示。 "right": 居右对齐显示。 96 | 97 | //游戏相关状态 98 | var IS_PAUSE = false; 99 | var IS_OVER = false; 100 | 101 | var BG_MUSIC_VOLUME = 0.5; 102 | 103 | 104 | var Sprite = laya.display.Sprite; 105 | var Handler = laya.utils.Handler; 106 | var Animation = laya.display.Animation; 107 | var SoundManager = laya.media.SoundManager; 108 | var Pool = laya.utils.Pool; 109 | var Text = laya.display.Text; 110 | var Tween = laya.utils.Tween; 111 | 112 | if( window.conch ) 113 | { 114 | //值为1:表示所有LOGE全部弹出alert 115 | //值为2:表示所有LOGE和LOGW全部弹出alert 116 | window.conch.config.setDebugLevel(2); 117 | } -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/init.js: -------------------------------------------------------------------------------- 1 | /*这里面只用于laya引擎初始化和图片加载功能 其他不管 */ 2 | //laya初始化 3 | Laya.init(BG_WIDTH, BG_HEIGHT, Laya.WebGL); 4 | //FPS 5 | // Laya.Stat.show(0, 0); 6 | //设置适配模式 7 | Laya.stage.scaleMode = "exactfit"; 8 | //设置居中对齐 9 | Laya.stage.alignH = "center"; 10 | //设置横屏 11 | Laya.stage.screenMode = "none"; 12 | //设置分辨率 13 | Laya.stage.scaleMode = "showall"; 14 | 15 | //loading 16 | var loading = new Loading(); 17 | Laya.stage.addChild(loading); 18 | 19 | this.runGame = null; 20 | 21 | //游戏介绍 22 | var gameInfo = new GameInfo(); 23 | 24 | //加载单个资源 25 | var asset = []; 26 | asset.push({ 27 | url: [ 28 | "res/BackGround.png", 29 | "res/tree0.png", 30 | "res/floor.png", 31 | "res/cat_sleep.png", 32 | "res/bird/bird_1.png", 33 | "res/bird/bird_2.png", 34 | "res/bird/bird_3.png", 35 | "res/bird/bird_4.png", 36 | "res/item/item_1.png", 37 | "res/item/item_2.png", 38 | "res/item/item_3.png", 39 | "res/item/item_4.png", 40 | "res/hp/hp_bg.png", 41 | "res/hp/hp_bar.png", 42 | "res/hp/en_bar.png", 43 | "res/effect.png", 44 | "res/particle/heart.png" 45 | ], 46 | type: Laya.Loader.IMAGE 47 | }); 48 | 49 | //加载图集资源 50 | asset.push({ 51 | url: "res/player.json", 52 | type: Laya.Loader.ATLAS 53 | }); 54 | 55 | //加载资源 56 | Laya.loader.load(asset, Handler.create(this, onLoaded), Handler.create(this, onLoading, null, false)); 57 | 58 | 59 | //加载进度 60 | function onLoading(progress) { 61 | console.log("正在加载,加载进度: " + progress + "\n"); 62 | loading.progress(progress); 63 | } 64 | 65 | //加载完成 66 | function onLoaded() { 67 | console.log("图片资源加载完毕\n"); 68 | //开始渲染游戏 69 | Laya.stage.renderingEnabled=true; 70 | //加载完毕移除loading 显示游戏提示UI 并且初始化游戏 71 | Laya.stage.removeChild(loading); 72 | //实例化RunGame 73 | var runGame = new RunGame(); 74 | this.runGame = runGame; 75 | //把RunGame添加到舞台上 76 | Laya.stage.addChild(runGame); 77 | Laya.stage.addChild(gameInfo); 78 | 79 | } 80 | 81 | function initGame(isRestartGame){ 82 | gameInfo.init("游戏已结束!请重新开始游戏!"); 83 | Laya.stage.removeChildren(this.runGame); 84 | onLoaded(); 85 | } 86 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/BackGround.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 背景类 4 | */ 5 | 6 | function BackGround() { 7 | //自定义背景1 8 | this.bg1 = null; 9 | //自定义背景2 10 | this.bg2 = null; 11 | //树木 12 | this.tree = null; 13 | //cat 14 | this.cat = null; 15 | 16 | 17 | BackGround.__super.call(this); 18 | this.init(); 19 | } 20 | 21 | //注册这个类 22 | Laya.class(BackGround, "BackGround", Sprite); 23 | 24 | //拿到原型 25 | var _proto = BackGround.prototype; 26 | 27 | _proto.init = function () { 28 | var texture1 = Laya.loader.getRes("res/BackGround.png"); 29 | var texture2 = Laya.loader.getRes("res/BackGround.png"); 30 | var textureTree = Laya.loader.getRes("res/tree0.png"); 31 | var textureCat = Laya.loader.getRes("res/m_background.png"); 32 | //播放背景音乐 33 | //背景音乐同时只能播放一个, 34 | //如果在播放背景音乐时再次调用本方法, 35 | //会先停止之前的背景音乐,再播放当前的背景音乐。 36 | //也就是说,这个方法只能用于背景音乐 37 | Laya.SoundManager.musicVolume = BG_MUSIC_VOLUME; 38 | Laya.SoundManager.playMusic("res/wav/BG.wav",0); 39 | //创建背景1 40 | this.bg1 = new Sprite(); 41 | //绘制背景图1 42 | this.bg1.graphics.drawTexture(texture1, 0, 0); 43 | //把背景1添加到当前容器对象里 44 | this.addChild(this.bg1); 45 | 46 | //创建背景2 47 | this.bg2 = new Sprite(); 48 | //绘制背景图2 49 | this.bg2.graphics.drawTexture(texture2, 0, 0); 50 | //把背景1添加到当前容器对象里 51 | this.addChild(this.bg2); 52 | //把第二个背景放到第一个背景后面紧跟着 53 | this.bg2.pos(BG_WIDTH, 0); 54 | 55 | //前景图片树木 56 | this.tree = new Sprite(); 57 | //绘制树木 58 | this.tree.graphics.drawTexture(textureTree, 0, 0); 59 | 60 | this.addChild(this.tree); 61 | 62 | this.tree.pos(BG_WIDTH, 64); 63 | 64 | //绘制猫 65 | this.cat = new Sprite(); 66 | 67 | this.cat.graphics.drawTexture(textureCat,0,0,64,64); 68 | 69 | this.addChild(this.cat); 70 | 71 | 72 | //创建一个帧循环处理函数,用于背景位置的更新,实现背景滚动效果。 73 | Laya.timer.frameLoop(BG_FRAME_DELAY, this, this.onLoop) 74 | 75 | } 76 | 77 | _proto.onLoop = function () { 78 | if(IS_PAUSE || IS_OVER){return;} 79 | 80 | //移动 81 | this.x -= BG_SPEED; 82 | 83 | //当背景1向左移动出游戏的显示区域,则将背景1的x轴坐标,向右移动*2. 84 | if (this.bg1.x + this.x <= -BG_WIDTH) { 85 | this.bg1.x += BG_WIDTH * 2; 86 | } 87 | //当背景2向左移动出游戏的显示区域,则将背景2的x轴坐标,向右移动*2. 88 | if (this.bg2.x + this.x <= -BG_WIDTH) { 89 | this.bg2.x += BG_WIDTH * 2; 90 | } 91 | //树木移动 92 | if (this.tree.x + this.x <= -BG_WIDTH) { 93 | this.tree.x += BG_WIDTH * 2; 94 | } 95 | //cat移动 96 | if (this.cat.x + this.x <= -BG_WIDTH) { 97 | this.cat.x += BG_WIDTH * 2; 98 | } 99 | } 100 | 101 | 102 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/EnergyBar.js: -------------------------------------------------------------------------------- 1 | //这里面包含了生命条和无敌状态能量条 2 | 3 | (function () { 4 | /** 5 | * 能量条,包含生命条和无敌状态能量条 6 | */ 7 | function EnergyBar(type) { 8 | //背景 9 | this.bg = null; 10 | //进度条 11 | this.bar = null; 12 | //最小值 13 | this.minValue = ENERGY_BAR_MIN_VALUE; 14 | //最大值 15 | this.maxValue = ENERGY_BAR_MAX_VALUE; 16 | //残影 17 | this.bodyEffect1 = null; 18 | this.bodyEffect2 = null; 19 | //特效 20 | this.spiritEffect = null; 21 | //当前值 22 | this.value = 0; 23 | EnergyBar.__super.call(this); 24 | 25 | this.SoundManager = laya.media.SoundManager; 26 | this.init(type); 27 | } 28 | 29 | //能量类型 30 | EnergyBar.TYPE_DECELERATION = "Deceleration";//减速 31 | EnergyBar.TYPE_INVINCIBLE = "Invincible";//无敌 32 | 33 | //注册 34 | Laya.class(EnergyBar, "EnergyBar", Sprite); 35 | 36 | var _proto = EnergyBar.prototype; 37 | 38 | _proto.init = function (type) { 39 | this.width = ENERGY_BG_BAR_WIDTH; 40 | this.height = ENERGY_BG_BAR_HEIGHT; 41 | //能量/血条背景 42 | var textureEnergyBarBG = Laya.loader.getRes("res/hp/hp_bg.png"); 43 | //这个会选择性加载能量条还是血条 44 | var textureEnergyBarType = null; 45 | //选择加载能量条还是血条 46 | switch (type) { 47 | //能量条 48 | case EnergyBar.TYPE_DECELERATION: 49 | textureEnergyBarType = Laya.loader.getRes("res/hp/en_bar.png"); 50 | break; 51 | //血条 52 | case EnergyBar.TYPE_INVINCIBLE: 53 | textureEnergyBarType = Laya.loader.getRes("res/hp/hp_bar.png"); 54 | break; 55 | } 56 | 57 | this.bg = new Sprite(); 58 | this.bar = new Sprite(); 59 | this.bar.x = ENERGY_BAR_X; 60 | this.bar.y = ENERGY_BAR_Y; 61 | 62 | this.bar.scale(this.value / this.maxValue,1); 63 | 64 | //绘制血条和能量条 65 | this.bg.graphics.drawTexture(textureEnergyBarBG, 0, 0, ENERGY_BG_BAR_WIDTH, ENERGY_BG_BAR_HEIGHT); 66 | this.bar.graphics.drawTexture(textureEnergyBarType, 0, 0, ENERGY_BAR_WIDTH, ENERGY_BAR_HEIGHT); 67 | 68 | this.addChild(this.bg); 69 | this.addChild(this.bar); 70 | } 71 | 72 | _proto.updateEnergyValue = function(value){ 73 | this.value = value; 74 | if(this.value > this.maxValue){this.value = this.maxValue} 75 | if(this.value < this.minValue){this.value = this.minValue} 76 | this.bar.scale(this.value / this.maxValue,1); 77 | } 78 | 79 | _proto.addEnergyValue = function(value){ 80 | this.value += value; 81 | this.updateEnergyValue(this.value); 82 | } 83 | 84 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/Floor.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 地板类 4 | */ 5 | function Floor() { 6 | 7 | //背景贴图 8 | this.bgTexture = null; 9 | //背景 10 | this.bg = null; 11 | //最大右边距离 12 | this.maxRight = 0; 13 | //是否完全出屏幕 14 | this.isOutComplete = false; 15 | //背景右边补丁 16 | this.rightBg = null; 17 | //当前地板上的物品的集合 18 | this.itemList = []; 19 | //当前地板上的Npc的集合 20 | this.birdList = []; 21 | //计时器,用于加快地板速度 22 | this.timer = null; 23 | 24 | Floor.__super.call(this); 25 | } 26 | 27 | //事件名称:OUT_COMPLETE 28 | //超过一定屏幕触发floor的OUT_COMPLETE事件 29 | Floor.OUT_COMPLETE = "floor_out_complete"; 30 | //整个地板都不在屏幕里面事件 31 | Floor.OUT_DIE = "floor_out_die"; 32 | 33 | //注册这个类 34 | Laya.class(Floor, "Floor", Sprite); 35 | 36 | var _proto = Floor.prototype; 37 | 38 | _proto.init = function (type) { 39 | /** 40 | * 初始化Floor 41 | */ 42 | //是否需要在地板上增加道具 43 | var isNeedItem = true; 44 | //如果不开启autoSize 父容器的宽度和高度无法获取 45 | this.autoSize = true; 46 | //初始化的时候将坐标放到屏幕右边 47 | this.x = BG_WIDTH; 48 | //应该把地板放在屏幕中间 49 | this.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2; 50 | 51 | if (this.bg == null) { 52 | //贴图纹理 53 | this.bgTexture = Laya.loader.getRes("res/floor.png"); 54 | this.bg = new Sprite(); 55 | //清空绘制 56 | this.bg.graphics.clear(); 57 | 58 | this.addChild(this.bg); 59 | } 60 | //绘制地板 61 | this.bg.graphics.drawTexture(this.bgTexture, 0, 0) 62 | 63 | if(isNeedItem){this.addItem();} 64 | this.addBird(); 65 | //创建一个帧循环处理函数 66 | Laya.timer.frameLoop(FLOOR_FRAME_DELAY, this, this.onLoop); 67 | } 68 | 69 | _proto.onLoop = function () { 70 | if(IS_PAUSE || IS_OVER) {return}; 71 | /** 72 | * 帧循环处理函数 73 | */ 74 | 75 | //让地板的速度和移动比背景快一点 76 | this.x -= FLOOR_SPEED; 77 | 78 | //地板的速度不断是累加的,最大是FLOOR_SPEED_MAX 79 | if(!IS_FLOOR_SPEED_MAX){this.moveFaster();} 80 | 81 | //判断是否出了边界 如果出了 就通知生成新的floor 这里增加一个变量来判断当前是否已经通知外部了 82 | if (!this.isOutComplete && (this.x + BG_WIDTH) < FLOOR_WIDTH) { 83 | 84 | this.isOutComplete = true; 85 | 86 | this.event(Floor.OUT_COMPLETE, this); 87 | 88 | } else if ((this.x + BG_WIDTH + FLOOR_WIDTH) < 0) { 89 | //判断整个floor是否不在屏幕里面了 如果不在了 移除当前floor 90 | Laya.timer.clear(this, this.onLoop); 91 | //如果有物品先隐藏 92 | for(var i = 0; i < this.itemList.length; i++){ 93 | // this.itemList[i].visible = false; 94 | } 95 | this.visible = false; 96 | this.event(Floor.OUT_DIE, this); 97 | 98 | } 99 | 100 | } 101 | 102 | /** 103 | * 允许在地板上添加物品 104 | */ 105 | _proto.addItem = function () { 106 | //创建一个随机数 107 | var randomNumber = parseInt(Math.random() * 10); 108 | //如果随机数小于五,不添加,因为会造成道具太多的问题 109 | if(randomNumber < 1) return; 110 | //需要添加的数量 111 | var addNum = 0; 112 | //计算道具的最大数量,现在强制道具的宽度都是32 113 | var maxItemNum = Math.floor( FLOOR_WIDTH / 32); 114 | //定制数量的规则 115 | if(maxItemNum >= 5){ 116 | addNum = 5 + Math.floor((maxItemNum - 5) * Math.random());; 117 | }else{ 118 | addNum = maxItemNum; 119 | } 120 | //计算居中的点 121 | var sx = FLOOR_WIDTH / addNum; 122 | var arr = []; 123 | var isHasSpecialItem = false; 124 | for(var i = 0;i 0 ){ 130 | item = this.itemList.shift();//shift() 方法用于把数组的第一个元素从其中删除,并返回第一个元素的值。 131 | item.visible = true; 132 | }else{ 133 | //从对象池中获取item 134 | var item = Pool.getItemByClass("Item",Item); 135 | } 136 | 137 | if(randomNumber >= 1-ITEM_INVINCIBLE_PROBABILITY ){ 138 | isHasSpecialItem = true; 139 | item.init(Item.ITEM_TYPE_INCINCIBLE);//无敌 140 | }else if(randomNumber >= 1-ITEM_DECELERAYION_PROBABILITY){ 141 | isHasSpecialItem = true; 142 | item.init(Item.ITEM_TYPE_DECELERATION);//减速 143 | }else if(randomNumber >= 1-ITEM_STAR_PROBABILITY){ 144 | isHasSpecialItem = true; 145 | item.init(Item.ITEM_TYPE_STAR);//星星,加分道具 146 | }else{ 147 | 148 | } 149 | item.x = sx + i * 32; 150 | item = item.randomItemPosition(item);//已经设置好了y值 151 | 152 | this.addChild(item); 153 | arr.push(item); 154 | } 155 | this.itemList = [].concat(arr) 156 | } 157 | 158 | /** 159 | * 获取当前当前地板上的所有物品 160 | */ 161 | _proto.getAllItems = function () { 162 | return this.itemList; 163 | } 164 | 165 | //放置npc 166 | _proto.addBird = function(){ 167 | //创建一个随机数 168 | var randomNumber = parseInt(Math.random() * 10); 169 | //如果随机数小于五,不添加,因为会造成npc太多的问题 170 | if(randomNumber < 5) return; 171 | //需要添加的数量 172 | var addNum = 0; 173 | //计算道具的最大数量 174 | var maxBirdNum = Math.floor( FLOOR_WIDTH / NPC_BIRD_INTANCE); 175 | //定制数量的规则 176 | if(maxBirdNum >= 5){ 177 | addNum = 5 + Math.floor((maxBirdNum - 5) * Math.random());; 178 | }else{ 179 | addNum = maxBirdNum; 180 | } 181 | //计算居中的点 182 | var sx = FLOOR_WIDTH / addNum; 183 | var arr = []; 184 | for(var i = 0;i 0 ){ 190 | bird = this.this.birdList.shift();//shift() 方法用于把数组的第一个元素从其中删除,并返回第一个元素的值。 191 | bird.visible = true; 192 | }else{ 193 | //从对象池中获取Npc 194 | var bird = Pool.getItemByClass("Npc",Npc); 195 | } 196 | if(randomNumber >= 1 - NPC_BIRD_PROBABLITY){ 197 | // console.log("randomNumber = " + randomNumber); 198 | bird.init(); 199 | } 200 | bird.x = sx + i * 128; 201 | bird = bird.randomNpcPosition(bird);//已经设置好了y值 202 | // console.log("bird.x="+bird.x + " bird.y=" + bird.x );.... 203 | 204 | this.addChild(bird); 205 | arr.push(bird); 206 | } 207 | this.birdList = [].concat(arr) 208 | } 209 | 210 | /** 211 | * 获取当前当前地板上的所有物品 212 | */ 213 | _proto.getAllNpcs = function () { 214 | return this.birdList; 215 | } 216 | 217 | //加快地板移动速度 218 | _proto.moveFaster = function(){ 219 | if(FLOOR_SPEED >= FLOOR_SPEED_MAX){ 220 | IS_FLOOR_SPEED_MAX = true; 221 | return; 222 | } 223 | window.clearTimeout(this.timer); 224 | FLOOR_SPEED += FLOOR_SPEED_FASTER_STEP; 225 | this.timer = window.setTimeout(this.moveFaster,100); 226 | } 227 | 228 | //减小地板移动速度 229 | _proto.moveLower = function(father){ 230 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 231 | IS_FLOOR_SPEED_MAX = false; 232 | father.player.isInLowerSpeed = false; 233 | father.player.decelerationEnergy.updateEnergyValue(0); 234 | return; 235 | } 236 | /** 237 | * 碰撞检测 238 | * @param x 239 | * @param y 240 | * @param playerStatus:"up" ? "down" 241 | */ 242 | _proto.checkHit = function (playerX, playerY, playerStatus) { 243 | /* 244 | 玩家在上方: 245 | 玩家的Y轴 < (地板Y+FLOOR_HEIGHT) 246 | 玩家Y > 地板Y 247 | 248 | 玩家在下方: 249 | 玩家的Y轴 > (地板Y+FLOOR_HEIGHT) 250 | 玩家Y < 地板Y 251 | */ 252 | if (playerY > this.y && playerY < (this.y + FLOOR_HEIGHT) && playerStatus == "up") { return true; } 253 | else if (playerY < this.y && playerY > (this.y + FLOOR_HEIGHT) && playerStatus == "down") { return true; } 254 | else { return false; } 255 | } 256 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/GameInfo.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | /** 4 | * 游戏介绍 5 | */ 6 | function GameInfo(){ 7 | this.bg = null; 8 | this.txt = null; 9 | GameInfo.__super.call(this); 10 | var message = null; 11 | this.init(message); 12 | } 13 | //GameInfo 14 | Laya.class(GameInfo,"GameInfo", laya.display.Sprite); 15 | 16 | var _proto = GameInfo.prototype; 17 | 18 | _proto.init = function(message){ 19 | this.width = BG_WIDTH; 20 | this.height = BG_HEIGHT; 21 | 22 | //暂停游戏 23 | IS_PAUSE = true; 24 | //黑色背景 25 | this.bg = new Sprite(); 26 | this.bg.alpha = 0.8; 27 | this.bg.graphics.drawRect(0,0,BG_WIDTH,BG_HEIGHT,"#000000"); 28 | this.addChild(this.bg); 29 | 30 | //loading文本 31 | this.txt = new Text(); 32 | this.txt.color = "#ffffff"; 33 | this.txt.fontSize = 20; 34 | if((message == "") || (message == null)){ 35 | this.txt.text = "游戏介绍\n\n点击可控制人物翻转\n\n左上角紫色条代表当前启动无敌状态 黄色条代表减速速状态\n\n\n好了 点击屏幕开始狂奔之旅吧~~"; 36 | }else{ 37 | this.txt.text = message; 38 | } 39 | this.txt.width = BG_WIDTH; 40 | this.txt.align = "center"; 41 | this.txt.y = (BG_HEIGHT - this.txt.height) * 0.5; 42 | this.addChild(this.txt); 43 | 44 | } 45 | 46 | 47 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/Item.js: -------------------------------------------------------------------------------- 1 | //这是各种图标 2 | (function () { 3 | /** 4 | * 物品类 5 | */ 6 | function Item() { 7 | //图标 8 | this.icon = null; 9 | //星星图标[普通积分道具] 10 | this.starTexture = null; 11 | //减速图标 12 | this.decelerationTexure = null; 13 | //无敌图标 14 | this.invincibleTexture = null; 15 | //图表类型[ITEM_TYPE_STAR ? ITEM_TYPE_DECELERATION ? ITEM_TYPE_INVINCIBLE] 16 | this.type = ""; 17 | this.directionStatus = "up"; 18 | 19 | Item.__super.call(this); 20 | } 21 | 22 | /*类型分类*/ 23 | //星星 24 | Item.ITEM_TYPE_STAR = "ITEM_TYPE_STAR"; 25 | //减速 26 | Item.ITEM_TYPE_DECELERATION = "ITEM_TYPE_DECELERATION"; 27 | //无敌 28 | Item.ITEM_TYPE_INCINCIBLE = "ITEM_TYPE_INVINCIBLE"; 29 | 30 | //注册这个类 31 | Laya.class(Item, "Item", laya.display.Sprite); 32 | 33 | //获取原型 34 | _proto = Item.prototype; 35 | //播放星星的碰撞效果 36 | _proto.TweenStar = function(item){Tween.to(item, {y : -5, scaleX : 0.1, alpha : 0}, 200, null, Handler.create(this, this.undefinedFunc, [item]));} 37 | //随机物品的上下位置 38 | _proto.randomItemPosition = function(item){ 39 | var randomNumber = parseInt(100*Math.random()); 40 | if(randomNumber <= 50){ 41 | //把道具放在上面 42 | item.directionStatus = "up"; 43 | item.y = -30; 44 | }else{ 45 | //把道具放在下面,并倒置 46 | item.directionStatus = "down"; 47 | item.y = FLOOR_HEIGHT + 50; 48 | //水平倾斜角度,默认值为0。以角度为单位 49 | item.skewX = 180; 50 | //垂直倾斜角度,默认值为0。以角度为单位。 51 | item.skewY = 180; 52 | //镜像翻转 53 | item.scaleX = -1; 54 | } 55 | return item; 56 | } 57 | _proto.init = function (type) { 58 | this.type = type; 59 | if (this.icon == null) { 60 | /*加载图集资源*/ 61 | this.starTexture = Laya.loader.getRes("res/item/item_1.png"); 62 | this.decelerationTexure = Laya.loader.getRes("res/item/item_3.png"); 63 | this.invincibleTexture = Laya.loader.getRes("res/item/item_4.png"); 64 | this.icon = new Sprite(); 65 | } 66 | this.icon.graphics.clear(); 67 | switch (type) { 68 | case Item.ITEM_TYPE_STAR: 69 | this.icon.graphics.drawTexture(this.starTexture,0,0,ITEM_STAR_WIDTH,ITEM_STAR_HEIGHT); 70 | break; 71 | case Item.ITEM_TYPE_DECELERATION: 72 | this.icon.graphics.drawTexture(this.decelerationTexure,0,0,ITEM_DECELERATION_WIDTH,ITEM_DECELERATION_HEIGHT); 73 | break; 74 | case Item.ITEM_TYPE_INCINCIBLE: 75 | this.icon.graphics.drawTexture(this.invincibleTexture,0,0,ITEM_INVINCIBLE_WIDTH,ITEM_INVINCIBLE_HEIGHT); 76 | break; 77 | default: 78 | alert("道具指令错误!"); 79 | break; 80 | } 81 | this.addChild(this.icon); 82 | } 83 | 84 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/Loading.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | /** 4 | * 加载类 5 | */ 6 | function Loading(){ 7 | this.bg = null; 8 | this.txt = null; 9 | Loading.__super.call(this); 10 | this.init(); 11 | } 12 | //Loading 13 | Laya.class(Loading,"Loading", laya.display.Sprite); 14 | 15 | var _proto = Loading.prototype; 16 | 17 | _proto.init = function(){ 18 | 19 | //黑色背景 20 | this.bg = new Sprite(); 21 | this.bg.graphics.drawRect(0,0,BG_WIDTH,BG_HEIGHT,"#000000"); 22 | this.addChild(this.bg); 23 | 24 | //loading文本 25 | this.txt = new Text(); 26 | this.txt.color = "#ffffff"; 27 | this.txt.fontSize = 30; 28 | this.txt.text = "Loading......"; 29 | this.txt.width = BG_WIDTH; 30 | this.txt.align = "center"; 31 | this.txt.y = (BG_HEIGHT - this.txt.height) * 0.5; 32 | this.addChild(this.txt); 33 | 34 | } 35 | _proto.progress = function(value){ 36 | this.txt.text = "Loading " + parseInt(value * 100) + "%"; 37 | } 38 | 39 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/MapFloor.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 地板地图管理类 4 | */ 5 | function MapFloor() { 6 | 7 | //要移除的地板 8 | this.dieFloorList = []; 9 | 10 | MapFloor.__super.call(this); 11 | 12 | this.init(); 13 | } 14 | 15 | //注册MapFloor 16 | Laya.class(MapFloor, "MapFloor", Sprite); 17 | 18 | var _proto = MapFloor.prototype; 19 | 20 | _proto.init = function () { 21 | 22 | var floor = this.addFloor(); 23 | //避免玩家最开始没有地板可以踩 24 | floor.x = 0; 25 | //创建一个帧循环函数 26 | Laya.timer.frameLoop(MAP_FLOOR_FRAME_DELAY, this, this.onLoop); 27 | 28 | } 29 | 30 | _proto.onLoop = function () { 31 | /** 32 | * 帧循环处理 33 | */ 34 | 35 | //监听有没有地板要移除 36 | while (this.dieFloorList.lenght > 0) { 37 | var floor = this.dieFloorList.shift(); 38 | floor.removeSelf(); 39 | //回收 40 | Pool.recover("floor",floor) 41 | 42 | } 43 | } 44 | 45 | _proto.addFloor = function () { 46 | /** 47 | * 增加地板 48 | */ 49 | 50 | var floor = Pool.getItemByClass("floor",Floor) 51 | 52 | floor.init(); 53 | floor.once(Floor.OUT_COMPLETE, this, this.getFloor); 54 | floor.once(Floor.OUT_DIE, this, this.delFloor); 55 | this.addChild(floor); 56 | return floor; 57 | } 58 | 59 | _proto.getFloor = function (floor) { 60 | /** 61 | * 获取地板 62 | */ 63 | this.addFloor(); 64 | } 65 | 66 | _proto.delFloor = function (floor) { 67 | /** 68 | * 删除地板 69 | */ 70 | this.dieFloorList.push(floor); 71 | } 72 | 73 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/Npc.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | /** 3 | * NPC 4 | */ 5 | function Npc(){ 6 | this.body = null; 7 | Npc.__super.call(this); 8 | this.init(); 9 | } 10 | 11 | //NPC注册 12 | Laya.class(Npc,"Npc",Sprite); 13 | 14 | //获取原型 15 | var _proto = Npc.prototype; 16 | Npc.cached = false; 17 | Npc.BIRD = "bird"; 18 | this.type = ""; 19 | Npc.NPC_TYPE_BIRD = "NPC_TYPE_BIRD"; 20 | 21 | _proto.init = function(){ 22 | 23 | //缓存动画 24 | if(!Npc.cached){ 25 | Npc.cached = true; 26 | Animation.createFrames(['res/bird/bird_1.png','res/bird/bird_2.png','res/bird/bird_3.png','res/bird/bird_4.png'], Npc.BIRD); 27 | } 28 | //创建Npc 29 | if(this.body == null){ 30 | this.body = new Animation(); 31 | this.body.interval = NPC_BIRD_INTERVAL; 32 | this.type = Npc.NPC_TYPE_BIRD; 33 | this.addChild(this.body); 34 | this.body.play(0, true, Npc.BIRD); 35 | //创建一个帧循环处理函数 36 | Laya.timer.frameLoop(1, this, this.onLoop); 37 | } 38 | 39 | } 40 | //帧循环函数 41 | _proto.onLoop = function(){ 42 | if(IS_OVER)return; 43 | if(this.body.x < -100){ 44 | this.removeSelf(); 45 | //回收 46 | Pool.recover("Npc",this); 47 | Laya.timer.clear(this, this.onLoop); 48 | } 49 | } 50 | //随机物品的上下位置 51 | _proto.randomNpcPosition = function(bird){ 52 | var randomNumber = parseInt(100*Math.random()); 53 | if(randomNumber <= 50){ 54 | //把道具放在上面 55 | bird.directionStatus = "up"; 56 | bird.y = -NPC_BIRD_HEIGHT/2; 57 | }else{ 58 | //把道具放在下面,并倒置 59 | bird.directionStatus = "down"; 60 | bird.y = FLOOR_HEIGHT + (NPC_BIRD_HEIGHT/3)*2; 61 | //水平倾斜角度,默认值为0。以角度为单位 62 | bird.skewX = 180; 63 | //垂直倾斜角度,默认值为0。以角度为单位。 64 | bird.skewY = 180; 65 | //镜像翻转 66 | bird.scaleX = -1; 67 | } 68 | return bird; 69 | } 70 | //放置位置应该是在地板处放置 71 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/Player.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 玩家类 4 | */ 5 | function Player(decelerationEnergy, invincibleEnergy) { 6 | 7 | //减速能量条的引用 8 | this.decelerationEnergy = decelerationEnergy; 9 | //无敌能量条的引用 10 | this.invincibleEnergy = invincibleEnergy; 11 | //当前动作 12 | this.action = null; 13 | //玩家 14 | this.body = null; 15 | //玩家状态 "up" ? "down" 16 | this.status = "up"; 17 | //玩家跑动状态 "normal" ? "deceleration" ? "invincible" 18 | //是否已经踩在地板上了 19 | this.isOnFloor = false; 20 | //是否在特效中 21 | this.isInEffect = false; 22 | //是否在减速状态下 23 | this.isInLowerSpeed = false; 24 | 25 | //下落变量 26 | this.vy = PLAYER_DOWN_VY; 27 | //下落速度 28 | this.downSpeed = PLAYER_DOWN_SPEED; 29 | //最大下落值 30 | this.maxVy = PLAYER_DOWN_MAX_SPEED; 31 | //是否停止下落 32 | this.isStopDown = false; 33 | 34 | //这里我们强制设置玩家的宽度和高度 35 | this.width = 96; 36 | this.height = 96; 37 | 38 | this.sp = null; 39 | 40 | Player.__super.call(this); 41 | //初始化 42 | this.init(); 43 | } 44 | 45 | 46 | //跑动 47 | Player.RUN = "player_run"; 48 | //飞行 49 | Player.FLY = "player_fly"; 50 | //状态 51 | Player.DIE = "player_die"; 52 | 53 | //注册 54 | Laya.class(Player, "Player", Sprite); 55 | 56 | //图集是否缓存,避免一次请求一次加载的状况 57 | Player.cached = false; 58 | 59 | //获取原型 60 | var _proto = Player.prototype; 61 | 62 | _proto.init = function () { 63 | //缓存动画 64 | if (!Player.cached) { 65 | 66 | //跑动的动画 67 | Animation.createFrames(['res/player/chara_01.png', 'res/player/chara_02.png', 'res/player/chara_03.png', 'res/player/chara_04.png'], Player.RUN); 68 | //飞行的动画 69 | Animation.createFrames(['res/player/chara_05.png', 'res/player/chara_06.png', 'res/player/chara_07.png', 'res/player/chara_08.png'], Player.FLY); 70 | //图像缓存完毕 71 | Player.cached = true; 72 | } 73 | 74 | if (this.body == null) { 75 | this.body = new Animation(); 76 | this.body.interval = PLAYER_RUN_SPEED; 77 | this.addChild(this.body); 78 | } 79 | 80 | //播放相应的动画 81 | this.playAction(Player.RUN); 82 | 83 | //创建帧循环处理函数 84 | Laya.timer.frameLoop(PLAYER_FRAME_DELAY, this, this.onLoop); 85 | } 86 | 87 | _proto.playAction = function (action) { 88 | //如果是重复动作,则不执行 89 | if (this.action == action) {return;}; 90 | 91 | this.action = action; 92 | //播放相应的动画 93 | this.body.play(0, true, this.action); 94 | } 95 | 96 | _proto.onLoop = function () { 97 | this.body.x = BG_WIDTH / 10; 98 | if (!this.isStopDown) {//在最开始玩家开始下落 99 | this.y += this.vy; 100 | this.vy += this.downSpeed; 101 | //控制下落最大值 102 | if (this.vy >= this.maxVy) { this.vy = this.maxVy }; 103 | //如果掉落到屏幕外 104 | if (this.y > BG_HEIGHT) { return; } 105 | } else if (this.isStopDown) { 106 | 107 | } else { 108 | 109 | } 110 | //判断玩家是否在特效中 111 | if(this.isInEffect){ 112 | //如果在特效中,慢慢的消耗能量,直到能量为0,就回到默认状态 113 | this.invincibleEnergy.addEnergyValue(-ITEM_INVINCIBLE_DESCENT_SPEED); 114 | if(this.invincibleEnergy.value <= 0){ 115 | this.hideEffect(); 116 | } 117 | } 118 | //判断是否在减速中 119 | if(this.isInLowerSpeed){ 120 | //如果在减速中,慢慢的消耗能量,直到能量为0,就回到默认状态 121 | this.decelerationEnergy.addEnergyValue(-ITEM_DECELERATION_DESCENT_SPEED); 122 | if(this.decelerationEnergy.value <= 0){ 123 | this.decelerationEnergy.updateEnergyValue(0); 124 | } 125 | } 126 | } 127 | 128 | _proto.hitCheck = function(playerX,playerY,itemX,itemY,itemDirectionStatus,itemTpye,playerStatus){ 129 | //console.log("px=" + playerX + " py=" + playerY + " ix=" + itemX + " iy=" + itemY + " xxx=" +- (((BG_HEIGHT - FLOOR_HEIGHT) / 2) - playerY)); 130 | var itemWidth = 0; 131 | var itemHeight = 0; 132 | //根据传过来的道具类型来确定物品的大小 133 | switch(itemTpye){ 134 | case Npc.NPC_TYPE_BIRD: 135 | itemWidth = NPC_BIRD_WIDTH; 136 | itemHeight = NPC_BIRD_HEIGHT; 137 | break; 138 | case Item.ITEM_TYPE_STAR: 139 | itemWidth = ITEM_STAR_WIDTH; 140 | itemHeight = ITEM_STAR_HEIGHT; 141 | break; 142 | case Item.ITEM_TYPE_DECELERATION: 143 | itemWidth = ITEM_DECELERATION_WIDTH; 144 | itemHeight = ITEM_DECELERATION_HEIGHT; 145 | break; 146 | case Item.ITEM_TYPE_INVINCIBLE: 147 | itemWidth = ITEM_INVINCIBLE_WIDTH; 148 | itemHeight = ITEM_INVINCIBLE_HEIGHT; 149 | break; 150 | } 151 | //判断碰撞要考虑前方后方和玩家转换方向后正好撞在道具上面 152 | if(playerStatus == "up"){ 153 | if(((playerX - Math.abs(itemX) - itemWidth/2 ) >= 0 ) && (itemDirectionStatus == "up") && (playerX < itemX + itemWidth + PLAYER_WIDTH/2)){ 154 | return true; 155 | }else{return false} 156 | }else if(playerStatus == "down"){ 157 | if((((playerX - Math.abs(itemX) - itemWidth/2 ) >= 0 ) && (itemDirectionStatus == "down") && (playerX < itemX + itemWidth + PLAYER_WIDTH/2))){ 158 | return true; 159 | }else{return false} 160 | } 161 | } 162 | 163 | //开始跑 164 | _proto.gotoRun = function () { 165 | this.playAction(Player.RUN); 166 | } 167 | //开始飞 168 | _proto.gotoFly = function () { 169 | this.playAction(Player.FLY); 170 | }; 171 | //翻转人物 172 | _proto.flip = function () { 173 | //如果玩家在上面,那么将玩家翻转到下面 174 | if (this.status == "up") { 175 | //设置玩家的当前状态 176 | this.status = "down"; 177 | //水平倾斜角度,默认值为0。以角度为单位 178 | this.body.skewX = 180; 179 | //垂直倾斜角度,默认值为0。以角度为单位。 180 | this.body.skewY = 180; 181 | //镜像翻转 182 | this.body.scaleX = -1; 183 | //设置Y轴的位置 184 | // this.body.y = (BG_HEIGHT/2) ; 185 | }else if(this.status == "down"){ 186 | //设置玩家的当前状态 187 | this.status = "up"; 188 | //水平倾斜角度,默认值为0。以角度为单位 189 | this.body.skewX = 0; 190 | //垂直倾斜角度,默认值为0。以角度为单位。 191 | this.body.skewY = 0; 192 | //镜像翻转 193 | this.body.scaleX = 1; 194 | //设置Y轴的位置 195 | // this.body.y -= (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30; 196 | } 197 | } 198 | 199 | //是否处于特效中 200 | _proto.isInEffect = false; 201 | 202 | //显示特效 203 | _proto.showEffect = function(){ 204 | if(!(this.invincibleEnergy.value >= 80 && this.isInEffect)){IS_PAUSE = true;/*暂停游戏*/ } 205 | this.isInEffect = true; 206 | this.gotoFly(); 207 | FLOOR_SPEED = 10; 208 | Laya.loader.load("res/particle/particle.part", Handler.create(this, this.Showparticle), null, Laya.Loader.JSON); 209 | } 210 | _proto.Showparticle = function(settings){ 211 | //播放无敌状态音乐 212 | SoundManager.playSound("res/wav/Invincible_start.wav",1); 213 | this.sp = new Laya.Particle2D(settings); 214 | // console.log(this.sp); 215 | this.sp.x = this.body.x*1.5; 216 | this.sp.y -= 20; 217 | this.addChild(this.sp); 218 | this.sp.emitter.start(); 219 | this.sp.emitter._emissionRate = 20; 220 | this.sp.play(); 221 | IS_PAUSE = false; 222 | } 223 | 224 | //特效停止 225 | _proto.hideEffect = function(){ 226 | //播放特效停止音效 227 | SoundManager.playSound("res/wav/Invincible_end.wav"); 228 | // this.sp.destroy(); 229 | this.sp.stop(); 230 | // this.sp.emitter.clear(); 231 | IS_FLOOR_SPEED_MAX = false; 232 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 233 | this.isInEffect = false; 234 | this.gotoRun(); 235 | } 236 | 237 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/js/runGame/RunGame.js: -------------------------------------------------------------------------------- 1 | //游戏主文件,入口文件 2 | (function () { 3 | /** 4 | * 游戏入口 5 | */ 6 | function RunGame() { 7 | 8 | this.bg = null; 9 | this.mapFloor = null; 10 | this.player = null; 11 | 12 | this.hpEnergy = null; 13 | this.speedEnergy = null; 14 | 15 | this.score = 0; 16 | 17 | this.isFirstPlayGame = true; 18 | 19 | RunGame.__super.call(this); 20 | 21 | this.init(); 22 | } 23 | 24 | //RunGame 是一个显示对象 继承此 Sprite 注册这个RunGame类 25 | Laya.class(RunGame, "RunGame", Sprite); 26 | 27 | //定义RumGame的原型 28 | var _proto = RunGame.prototype; 29 | 30 | //初始化 31 | _proto.init = function () { 32 | //添加背景 33 | this.bg = new BackGround(); 34 | this.addChild(this.bg); 35 | 36 | //添加地板 37 | this.mapFloor = new MapFloor(); 38 | this.addChild(this.mapFloor); 39 | 40 | //无敌能量条 41 | this.Invincible = new EnergyBar(EnergyBar.TYPE_INVINCIBLE); 42 | this.Invincible.y = 7; 43 | this.addChild(this.Invincible); 44 | 45 | //减速能量条 46 | this.Deceleration = new EnergyBar(EnergyBar.TYPE_DECELERATION); 47 | this.Deceleration.y = 7; 48 | this.Deceleration.x = this.Invincible.width + 10; 49 | this.addChild(this.Deceleration); 50 | 51 | //分数 52 | this.scoreText = new Text(); 53 | this.scoreText.color = SCORETEXT_COLOR; 54 | this.scoreText.fontSize = SCORETEXT_FONT_SIZE; 55 | this.scoreText.text = SCORETEXT_TEXT_DEFAULT; 56 | this.scoreText.width = BG_WIDTH; 57 | this.scoreText.align = SCORETEXT_ALIGN; 58 | this.scoreText.x = -10; 59 | this.scoreText.y = 10; 60 | this.addChild(this.scoreText); 61 | 62 | //添加主角 63 | this.player = new Player(this.Invincible,this.Deceleration); 64 | this.addChild(this.player); 65 | 66 | //监听鼠标按下弹起事件 67 | Laya.stage.on(laya.events.Event.MOUSE_DOWN, this, this.onMouseDown) 68 | 69 | //创建帧循环处理函数 70 | Laya.timer.frameLoop(1, this, this.onLoop); 71 | } 72 | 73 | _proto.onLoop = function () { 74 | //获取所有的地板 75 | for (var i = this.mapFloor.numChildren - 1; i > - 1; i--) { 76 | var floor = this.mapFloor.getChildAt(i); 77 | //判断玩家是否踩在了地板上,已经踩在地板上就可以终止判断了 78 | if (!this.player.isOnFloor) { 79 | //检测主角是否踩在地板上 80 | if (floor.checkHit(this.player.x, this.player.y, this.player.status)) { 81 | //人物如果踩到地板了 就把人物的坐标设置到地板上面 82 | if (this.player.status == "up") { 83 | this.player.isStopDown = true;//停止下落 84 | this.player.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30; 85 | // this.player.y -= 128; 86 | this.bg.cat.pos(BG_WIDTH * 1.2, this.player.y - 30); 87 | this.player.isOnFloor = true; 88 | } else if (this.player.status == "down") { } 89 | } 90 | } 91 | //检测是否碰到道具了 92 | var itemList = floor.getAllItems(); 93 | var npcList = floor.getAllNpcs(); 94 | for(var j = 0;j < itemList.length;j++){ 95 | var item = itemList[j]; 96 | //只有显示的物品才做碰撞检测 97 | if(item.visible ){ 98 | //拿到物品的位置信息 99 | if(this.player.hitCheck(this.player.body.x,this.player.y,item.x + floor.x - PLAYER_WIDTH,item.y,item.directionStatus,item.type,this.player.status)){ 100 | //物品有多个类型 分类型进行判断 101 | if(item.type == Item.ITEM_TYPE_DECELERATION){ 102 | //播放减速道具音乐 103 | SoundManager.playSound("res/wav/DecelerationCounting.wav",1); 104 | item.visible = false; 105 | this.player.decelerationEnergy.addEnergyValue(20); 106 | if(this.player.decelerationEnergy.value >= 100){ 107 | if(!this.player.isInEffect){ 108 | //减速 109 | this.player.decelerationEnergy.updateEnergyValue(100); 110 | this.player.isInLowerSpeed = true; 111 | //播放减速效果音效 112 | SoundManager.playSound("res/wav/LowerSpeed.wav",1); 113 | floor.moveLower(this); 114 | } 115 | } 116 | }else if(item.type == Item.ITEM_TYPE_INCINCIBLE){ 117 | //播放无敌药水的声音 118 | SoundManager.playSound("res/wav/InvincibleCounting.wav",1); 119 | item.visible = false; 120 | this.player.invincibleEnergy.addEnergyValue(20); 121 | if(this.player.invincibleEnergy.value == 100 && !this.player.isInEffect){ 122 | //无敌 123 | 124 | this.player.showEffect();} 125 | 126 | }else{ 127 | this.scoreAdd(1); 128 | //播放星星的相关音乐 129 | SoundManager.playSound("res/wav/StarCounting.wav",1); 130 | item.visible = false; 131 | //星星物品播放动画 132 | // item.TweenStar(item); 133 | } 134 | 135 | } 136 | } 137 | } 138 | //npc碰撞检测 139 | for(var k = 0;k < npcList.length;k++){ 140 | var npc = npcList[k]; 141 | //只有显示的npc才做碰撞检测 142 | if(npc.visible){ 143 | //拿到npc的位置信息 144 | if(this.player.hitCheck(this.player.body.x,this.player.y,npc.x + floor.x - PLAYER_WIDTH,npc.y,npc.directionStatus,npc.type,this.player.status)){ 145 | //npc类型判断 146 | switch(npc.type){ 147 | case Npc.NPC_TYPE_BIRD: 148 | if(this.player.isInEffect){break;} 149 | //停止游戏 150 | this.stopAllGame(); 151 | var isRestartGame = true; 152 | initGame(isRestartGame);//位于init.js 153 | } 154 | } 155 | } 156 | 157 | } 158 | } 159 | 160 | } 161 | //分数栏更新 162 | _proto.scoreAdd = function(value){ 163 | this.scoreText.text = parseInt(this.scoreText.text) + value; 164 | // console.log(this.scoreText.text + " " + typeof(this.scoreText.text)); 165 | } 166 | //鼠标按下事件 167 | _proto.onMouseDown = function () { 168 | if(this.isFirstPlayGame){ 169 | //移除gameInfo 170 | Laya.stage.removeChild(gameInfo); 171 | //移除之后游戏开始 172 | IS_PAUSE = false; 173 | isFirstPlayGame = false; 174 | } 175 | //在下落过程中不允许翻转 176 | if (!this.player.isOnFloor) { return; } 177 | 178 | this.player.flip(); 179 | //不知道为何,在Player里面设置XY一直不成功,所以改在这里设置 180 | // console.log("玩家状态:" + this.player.status + " 玩家Y轴位置:" + this.player.y); 181 | if (this.player.status == "up") { this.player.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30 } 182 | else if (this.player.status == "down") { this.player.y = ((BG_HEIGHT + FLOOR_HEIGHT) / 2) + PLAYER_HEIGHT - 15 } 183 | } 184 | //停止游戏 185 | _proto.stopAllGame = function(){ 186 | //停止渲染游戏 187 | Laya.stage.renderingEnabled=false; 188 | //清除减速条数据 189 | this.player.decelerationEnergy.updateEnergyValue(0); 190 | //清除无敌条数据 191 | this.player.invincibleEnergy.updateEnergyValue(0); 192 | //清除分数数据 193 | this.scoreText.text = SCORETEXT_TEXT_DEFAULT; 194 | //清除奔跑速度数据 195 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 196 | //停止播放所有声音 197 | SoundManager.stopAll(); 198 | //设置人物状态 199 | this.player.status = "down"; 200 | //停止循环 201 | Laya.timer.clear(this,this.onLoop); 202 | } 203 | })(); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/libs/laya.d3Plugin.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var Component3D=laya.d3.component.Component3D,MeshTerrainSprite3D=laya.d3.core.MeshTerrainSprite3D; 6 | var Sprite3D=laya.d3.core.Sprite3D; 7 | /** 8 | *PathFinding 类用于创建寻路。 9 | */ 10 | //class laya.d3.component.PathFind extends laya.d3.component.Component3D 11 | var PathFind=(function(_super){ 12 | function PathFind(){ 13 | this._meshTerrainSprite3D=null; 14 | this._finder=null; 15 | this._setting=null; 16 | this.grid=null; 17 | PathFind.__super.call(this); 18 | } 19 | 20 | __class(PathFind,'laya.d3.component.PathFind',_super); 21 | var __proto=PathFind.prototype; 22 | /** 23 | *@private 24 | *初始化载入蒙皮动画组件。 25 | *@param owner 所属精灵对象。 26 | */ 27 | __proto._load=function(owner){ 28 | if (! (owner instanceof laya.d3.core.MeshTerrainSprite3D )) 29 | throw new Error("PathFinding: The owner must MeshTerrainSprite3D!"); 30 | _super.prototype._load.call(this,owner); 31 | this._meshTerrainSprite3D=owner; 32 | } 33 | 34 | /** 35 | *寻找路径。 36 | *@param startX 开始X。 37 | *@param startZ 开始Z。 38 | *@param endX 结束X。 39 | *@param endZ 结束Z。 40 | *@return 路径。 41 | */ 42 | __proto.findPath=function(startX,startZ,endX,endZ){ 43 | var minX=this._meshTerrainSprite3D.minX; 44 | var minZ=this._meshTerrainSprite3D.minZ; 45 | var cellX=this._meshTerrainSprite3D.width / this.grid.width; 46 | var cellZ=this._meshTerrainSprite3D.depth / this.grid.height; 47 | var halfCellX=cellX / 2; 48 | var halfCellZ=cellZ / 2; 49 | var gridStartX=Math.floor((startX-minX)/ cellX); 50 | var gridStartZ=Math.floor((startZ-minZ)/ cellZ); 51 | var gridEndX=Math.floor((endX-minX)/ cellX); 52 | var gridEndZ=Math.floor((endZ-minZ)/ cellZ); 53 | var boundWidth=this.grid.width-1; 54 | var boundHeight=this.grid.height-1; 55 | (gridStartX > boundWidth)&& (gridStartX=boundWidth); 56 | (gridStartZ > boundHeight)&& (gridStartZ=boundHeight); 57 | (gridStartX < 0)&& (gridStartX=0); 58 | (gridStartZ < 0)&& (gridStartZ=0); 59 | (gridEndX > boundWidth)&& (gridEndX=boundWidth); 60 | (gridEndZ > boundHeight)&& (gridEndZ=boundHeight); 61 | (gridEndX < 0)&& (gridEndX=0); 62 | (gridEndZ < 0)&& (gridEndZ=0); 63 | var path=this._finder.findPath(gridStartX,gridStartZ,gridEndX,gridEndZ,this.grid); 64 | this.grid.reset(); 65 | for (var i=1;i < path.length-1;i++){ 66 | var gridPos=path[i]; 67 | gridPos[0]=gridPos[0] *cellX+halfCellX+minX; 68 | gridPos[1]=gridPos[1] *cellZ+halfCellZ+minZ; 69 | } 70 | if (path.length==1){ 71 | path[0][0]=endX; 72 | path[0][1]=endX; 73 | }else if (path.length > 1){ 74 | path[0][0]=startX; 75 | path[0][1]=startZ; 76 | path[path.length-1][0]=endX; 77 | path[path.length-1][1]=endZ; 78 | } 79 | return path; 80 | } 81 | 82 | /** 83 | *设置寻路设置。 84 | *@param value 寻路设置。 85 | */ 86 | /** 87 | *获取寻路设置。 88 | *@return 寻路设置。 89 | */ 90 | __getset(0,__proto,'setting',function(){ 91 | return this._setting; 92 | },function(value){ 93 | (value)&& (this._finder=new PathFinding.finders.AStarFinder(value)); 94 | this._setting=value; 95 | }); 96 | 97 | return PathFind; 98 | })(Component3D) 99 | 100 | 101 | 102 | })(window,document,Laya); 103 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/libs/laya.filter.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var BlendMode=laya.webgl.canvas.BlendMode,Browser=laya.utils.Browser,Color=laya.utils.Color,ColorFilterAction=laya.filters.ColorFilterAction; 6 | var ColorFilterActionGL=laya.filters.webgl.ColorFilterActionGL,Filter=laya.filters.Filter,FilterActionGL=laya.filters.webgl.FilterActionGL; 7 | var Matrix=laya.maths.Matrix,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,RenderContext=laya.renders.RenderContext; 8 | var RenderTarget2D=laya.webgl.resource.RenderTarget2D,RunDriver=laya.utils.RunDriver,ShaderDefines2D=laya.webgl.shader.d2.ShaderDefines2D; 9 | var Sprite=laya.display.Sprite,SubmitCMD=laya.webgl.submit.SubmitCMD,Texture=laya.resource.Texture,Value2D=laya.webgl.shader.d2.value.Value2D; 10 | /** 11 | *默认的FILTER,什么都不做 12 | *@private 13 | */ 14 | //class laya.filters.FilterAction 15 | var FilterAction=(function(){ 16 | function FilterAction(){ 17 | this.data=null; 18 | } 19 | 20 | __class(FilterAction,'laya.filters.FilterAction'); 21 | var __proto=FilterAction.prototype; 22 | Laya.imps(__proto,{"laya.filters.IFilterAction":true}) 23 | __proto.apply=function(data){ 24 | return null; 25 | } 26 | 27 | return FilterAction; 28 | })() 29 | 30 | 31 | /** 32 | *@private 33 | */ 34 | //class laya.filters.WebGLFilter 35 | var WebGLFilter=(function(){ 36 | function WebGLFilter(){}; 37 | __class(WebGLFilter,'laya.filters.WebGLFilter'); 38 | WebGLFilter.enable=function(){ 39 | if (WebGLFilter.isInit)return; 40 | WebGLFilter.isInit=true; 41 | if (!Render.isWebGL)return; 42 | RunDriver.createFilterAction=function (type){ 43 | var action; 44 | switch (type){ 45 | case /*laya.filters.Filter.COLOR*/0x20: 46 | action=new ColorFilterActionGL(); 47 | break ; 48 | case /*laya.filters.Filter.BLUR*/0x10: 49 | action=new BlurFilterActionGL(); 50 | break ; 51 | case /*laya.filters.Filter.GLOW*/0x08: 52 | action=new GlowFilterActionGL(); 53 | break ; 54 | } 55 | return action; 56 | } 57 | } 58 | 59 | WebGLFilter.isInit=false; 60 | WebGLFilter.__init$=function(){ 61 | BlurFilterActionGL; 62 | ColorFilterActionGL; 63 | GlowFilterActionGL; 64 | Render; 65 | RunDriver;{ 66 | RunDriver.createFilterAction=function (type){ 67 | var action; 68 | switch (type){ 69 | case /*laya.filters.Filter.BLUR*/0x10: 70 | action=new FilterAction(); 71 | break ; 72 | case /*laya.filters.Filter.GLOW*/0x08: 73 | action=new FilterAction(); 74 | break ; 75 | case /*laya.filters.Filter.COLOR*/0x20: 76 | action=new ColorFilterAction(); 77 | break ; 78 | } 79 | return action; 80 | } 81 | } 82 | } 83 | 84 | return WebGLFilter; 85 | })() 86 | 87 | 88 | /** 89 | *模糊滤镜 90 | */ 91 | //class laya.filters.BlurFilter extends laya.filters.Filter 92 | var BlurFilter=(function(_super){ 93 | function BlurFilter(strength){ 94 | this.strength=NaN; 95 | BlurFilter.__super.call(this); 96 | (strength===void 0)&& (strength=4); 97 | if (Render.isWebGL)WebGLFilter.enable(); 98 | this.strength=strength; 99 | this._action=RunDriver.createFilterAction(0x10); 100 | this._action.data=this; 101 | } 102 | 103 | __class(BlurFilter,'laya.filters.BlurFilter',_super); 104 | var __proto=BlurFilter.prototype; 105 | /** 106 | *@private 通知微端 107 | */ 108 | __proto.callNative=function(sp){ 109 | sp.conchModel &&sp.conchModel.blurFilter&&sp.conchModel.blurFilter(this.strength); 110 | } 111 | 112 | /** 113 | *@private 114 | *当前滤镜对应的操作器 115 | */ 116 | __getset(0,__proto,'action',function(){ 117 | return this._action; 118 | }); 119 | 120 | /** 121 | *@private 122 | *当前滤镜的类型 123 | */ 124 | __getset(0,__proto,'type',function(){ 125 | return 0x10; 126 | }); 127 | 128 | return BlurFilter; 129 | })(Filter) 130 | 131 | 132 | /** 133 | *发光滤镜(也可以当成阴影滤使用) 134 | */ 135 | //class laya.filters.GlowFilter extends laya.filters.Filter 136 | var GlowFilter=(function(_super){ 137 | function GlowFilter(color,blur,offX,offY){ 138 | this._color=null; 139 | GlowFilter.__super.call(this); 140 | this._elements=new Float32Array(9); 141 | (blur===void 0)&& (blur=4); 142 | (offX===void 0)&& (offX=6); 143 | (offY===void 0)&& (offY=6); 144 | if (Render.isWebGL){ 145 | WebGLFilter.enable(); 146 | } 147 | this._color=new Color(color); 148 | this.blur=Math.min(blur,20); 149 | this.offX=offX; 150 | this.offY=offY; 151 | this._action=RunDriver.createFilterAction(0x08); 152 | this._action.data=this; 153 | } 154 | 155 | __class(GlowFilter,'laya.filters.GlowFilter',_super); 156 | var __proto=GlowFilter.prototype; 157 | /**@private */ 158 | __proto.getColor=function(){ 159 | return this._color._color; 160 | } 161 | 162 | /** 163 | *@private 通知微端 164 | */ 165 | __proto.callNative=function(sp){ 166 | sp.conchModel &&sp.conchModel.glowFilter&&sp.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6]); 167 | } 168 | 169 | /** 170 | *@private 171 | *滤镜类型 172 | */ 173 | __getset(0,__proto,'type',function(){ 174 | return 0x08; 175 | }); 176 | 177 | /**@private */ 178 | __getset(0,__proto,'action',function(){ 179 | return this._action; 180 | }); 181 | 182 | /**@private */ 183 | /**@private */ 184 | __getset(0,__proto,'offY',function(){ 185 | return this._elements[6]; 186 | },function(value){ 187 | this._elements[6]=value; 188 | }); 189 | 190 | /**@private */ 191 | /**@private */ 192 | __getset(0,__proto,'offX',function(){ 193 | return this._elements[5]; 194 | },function(value){ 195 | this._elements[5]=value; 196 | }); 197 | 198 | /**@private */ 199 | /**@private */ 200 | __getset(0,__proto,'blur',function(){ 201 | return this._elements[4]; 202 | },function(value){ 203 | this._elements[4]=value; 204 | }); 205 | 206 | return GlowFilter; 207 | })(Filter) 208 | 209 | 210 | /** 211 | *@private 212 | */ 213 | //class laya.filters.webgl.BlurFilterActionGL extends laya.filters.webgl.FilterActionGL 214 | var BlurFilterActionGL=(function(_super){ 215 | function BlurFilterActionGL(){ 216 | this.data=null; 217 | BlurFilterActionGL.__super.call(this); 218 | } 219 | 220 | __class(BlurFilterActionGL,'laya.filters.webgl.BlurFilterActionGL',_super); 221 | var __proto=BlurFilterActionGL.prototype; 222 | __proto.setValueMix=function(shader){ 223 | shader.defines.add(this.data.type); 224 | var o=shader; 225 | } 226 | 227 | __proto.apply3d=function(scope,sprite,context,x,y){ 228 | var b=scope.getValue("bounds"); 229 | var shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 230 | shaderValue.setFilters([this.data]); 231 | var tMatrix=Matrix.EMPTY; 232 | tMatrix.identity(); 233 | context.ctx.drawTarget(scope,0,0,b.width,b.height,Matrix.EMPTY,"src",shaderValue); 234 | shaderValue.setFilters(null); 235 | } 236 | 237 | __proto.setValue=function(shader){ 238 | shader.strength=this.data.strength; 239 | } 240 | 241 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.BLUR*/0x10;}); 242 | return BlurFilterActionGL; 243 | })(FilterActionGL) 244 | 245 | 246 | /** 247 | *@private 248 | */ 249 | //class laya.filters.webgl.GlowFilterActionGL extends laya.filters.webgl.FilterActionGL 250 | var GlowFilterActionGL=(function(_super){ 251 | function GlowFilterActionGL(){ 252 | this.data=null; 253 | this._initKey=false; 254 | this._textureWidth=0; 255 | this._textureHeight=0; 256 | GlowFilterActionGL.__super.call(this); 257 | } 258 | 259 | __class(GlowFilterActionGL,'laya.filters.webgl.GlowFilterActionGL',_super); 260 | var __proto=GlowFilterActionGL.prototype; 261 | Laya.imps(__proto,{"laya.filters.IFilterActionGL":true}) 262 | __proto.setValueMix=function(shader){} 263 | __proto.apply3d=function(scope,sprite,context,x,y){ 264 | var b=scope.getValue("bounds"); 265 | scope.addValue("color",this.data.getColor()); 266 | var w=b.width,h=b.height; 267 | this._textureWidth=w; 268 | this._textureHeight=h; 269 | var submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.tmpTarget); 270 | context.ctx.addRenderObject(submit); 271 | var shaderValue; 272 | var mat=Matrix.TEMP; 273 | mat.identity(); 274 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 275 | shaderValue.setFilters([this.data]); 276 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue,null,BlendMode.TOINT.overlay); 277 | submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.startOut); 278 | context.ctx.addRenderObject(submit); 279 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 280 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"tmpTarget",shaderValue,Texture.INV_UV,BlendMode.TOINT.overlay); 281 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 282 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue); 283 | submit=SubmitCMD.create([scope,sprite,context,0,0],GlowFilterActionGL.recycleTarget); 284 | context.ctx.addRenderObject(submit); 285 | return null; 286 | } 287 | 288 | __proto.setSpriteWH=function(sprite){ 289 | this._textureWidth=sprite.width; 290 | this._textureHeight=sprite.height; 291 | } 292 | 293 | __proto.setValue=function(shader){ 294 | shader.u_offsetX=this.data.offX; 295 | shader.u_offsetY=-this.data.offY; 296 | shader.u_strength=1.0; 297 | shader.u_blurX=this.data.blur; 298 | shader.u_blurY=this.data.blur; 299 | shader.u_textW=this._textureWidth; 300 | shader.u_textH=this._textureHeight; 301 | shader.u_color=this.data.getColor(); 302 | } 303 | 304 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.GLOW*/0x08;}); 305 | GlowFilterActionGL.tmpTarget=function(scope,sprite,context,x,y){ 306 | var b=scope.getValue("bounds"); 307 | var out=scope.getValue("out"); 308 | out.end(); 309 | var tmpTarget=RenderTarget2D.create(b.width,b.height); 310 | tmpTarget.start(); 311 | var color=scope.getValue("color"); 312 | if (color){ 313 | tmpTarget.clear(color[0],color[1],color[2],0); 314 | } 315 | scope.addValue("tmpTarget",tmpTarget); 316 | } 317 | 318 | GlowFilterActionGL.startOut=function(scope,sprite,context,x,y){ 319 | var tmpTarget=scope.getValue("tmpTarget"); 320 | tmpTarget.end(); 321 | var out=scope.getValue("out"); 322 | out.start(); 323 | var color=scope.getValue("color"); 324 | if (color){ 325 | out.clear(color[0],color[1],color[2],0); 326 | } 327 | } 328 | 329 | GlowFilterActionGL.recycleTarget=function(scope,sprite,context,x,y){ 330 | var src=scope.getValue("src"); 331 | var tmpTarget=scope.getValue("tmpTarget"); 332 | tmpTarget.recycle(); 333 | } 334 | 335 | return GlowFilterActionGL; 336 | })(FilterActionGL) 337 | 338 | 339 | Laya.__init([WebGLFilter]); 340 | })(window,document,Laya); 341 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/libs/min/laya.d3Plugin.min.js: -------------------------------------------------------------------------------- 1 | !function(t,i,e){var n=(e.un,e.uns,e.static,e.class),r=e.getset,h=(e.__newvec,laya.d3.component.Component3D);laya.d3.core.MeshTerrainSprite3D,laya.d3.core.Sprite3D,function(t){function i(){this._meshTerrainSprite3D=null,this._finder=null,this._setting=null,this.grid=null,i.__super.call(this)}n(i,"laya.d3.component.PathFind",t);var e=i.prototype;e._load=function(i){if(!(i instanceof laya.d3.core.MeshTerrainSprite3D))throw new Error("PathFinding: The owner must MeshTerrainSprite3D!");t.prototype._load.call(this,i),this._meshTerrainSprite3D=i},e.findPath=function(t,i,e,n){var r=this._meshTerrainSprite3D.minX,h=this._meshTerrainSprite3D.minZ,a=this._meshTerrainSprite3D.width/this.grid.width,s=this._meshTerrainSprite3D.depth/this.grid.height,o=a/2,d=s/2,l=Math.floor((t-r)/a),g=Math.floor((i-h)/s),f=Math.floor((e-r)/a),c=Math.floor((n-h)/s),p=this.grid.width-1,u=this.grid.height-1;l>p&&(l=p),g>u&&(g=u),l<0&&(l=0),g<0&&(g=0),f>p&&(f=p),c>u&&(c=u),f<0&&(f=0),c<0&&(c=0);var _=this._finder.findPath(l,g,f,c,this.grid);this.grid.reset();for(var m=1;m<_.length-1;m++){var D=_[m];D[0]=D[0]*a+o+r,D[1]=D[1]*s+d+h}return 1==_.length?(_[0][0]=e,_[0][1]=e):_.length>1&&(_[0][0]=t,_[0][1]=i,_[_.length-1][0]=e,_[_.length-1][1]=n),_},r(0,e,"setting",function(){return this._setting},function(t){t&&(this._finder=new PathFinding.finders.AStarFinder(t)),this._setting=t}),i}(h)}(window,document,Laya); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/libs/min/laya.filter.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e,i){var r=(i.un,i.uns,i.static,i.class),a=i.getset,n=(i.__newvec,laya.webgl.canvas.BlendMode),l=(laya.utils.Browser,laya.utils.Color),s=laya.filters.ColorFilterAction,o=laya.filters.webgl.ColorFilterActionGL,u=laya.filters.Filter,c=laya.filters.webgl.FilterActionGL,h=laya.maths.Matrix,d=(laya.maths.Rectangle,laya.renders.Render),f=(laya.renders.RenderContext,laya.webgl.resource.RenderTarget2D),_=laya.utils.RunDriver,g=(laya.webgl.shader.d2.ShaderDefines2D,laya.display.Sprite,laya.webgl.submit.SubmitCMD),y=laya.resource.Texture,b=laya.webgl.shader.d2.value.Value2D,p=function(){function t(){this.data=null}r(t,"laya.filters.FilterAction");var e=t.prototype;return i.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){return null},t}(),w=function(){function t(){}return r(t,"laya.filters.WebGLFilter"),t.enable=function(){t.isInit||(t.isInit=!0,d.isWebGL&&(_.createFilterAction=function(t){var e;switch(t){case 32:e=new o;break;case 16:e=new v;break;case 8:e=new x}return e}))},t.isInit=!1,t.__init$=function(){_.createFilterAction=function(t){var e;switch(t){case 16:e=new p;break;case 8:e=new p;break;case 32:e=new s}return e}},t}(),v=(function(t){function e(t){this.strength=NaN,e.__super.call(this),void 0===t&&(t=4),d.isWebGL&&w.enable(),this.strength=t,this._action=_.createFilterAction(16),this._action.data=this}r(e,"laya.filters.BlurFilter",t);var i=e.prototype;i.callNative=function(t){t.conchModel&&t.conchModel.blurFilter&&t.conchModel.blurFilter(this.strength)},a(0,i,"action",function(){return this._action}),a(0,i,"type",function(){return 16}),e}(u),function(t){function e(t,i,r,a){this._color=null,e.__super.call(this),this._elements=new Float32Array(9),void 0===i&&(i=4),void 0===r&&(r=6),void 0===a&&(a=6),d.isWebGL&&w.enable(),this._color=new l(t),this.blur=Math.min(i,20),this.offX=r,this.offY=a,this._action=_.createFilterAction(8),this._action.data=this}r(e,"laya.filters.GlowFilter",t);var i=e.prototype;i.getColor=function(){return this._color._color},i.callNative=function(t){t.conchModel&&t.conchModel.glowFilter&&t.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6])},a(0,i,"type",function(){return 8}),a(0,i,"action",function(){return this._action}),a(0,i,"offY",function(){return this._elements[6]},function(t){this._elements[6]=t}),a(0,i,"offX",function(){return this._elements[5]},function(t){this._elements[5]=t}),a(0,i,"blur",function(){return this._elements[4]},function(t){this._elements[4]=t}),e}(u),function(t){function e(){this.data=null,e.__super.call(this)}r(e,"laya.filters.webgl.BlurFilterActionGL",t);var i=e.prototype;return i.setValueMix=function(t){t.defines.add(this.data.type)},i.apply3d=function(t,e,i,r,a){var n=t.getValue("bounds"),l=b.create(1,0);l.setFilters([this.data]),h.EMPTY.identity(),i.ctx.drawTarget(t,0,0,n.width,n.height,h.EMPTY,"src",l),l.setFilters(null)},i.setValue=function(t){t.strength=this.data.strength},a(0,i,"typeMix",function(){return 16}),e}(c)),x=function(t){function e(){this.data=null,this._initKey=!1,this._textureWidth=0,this._textureHeight=0,e.__super.call(this)}r(e,"laya.filters.webgl.GlowFilterActionGL",t);var l=e.prototype;return i.imps(l,{"laya.filters.IFilterActionGL":!0}),l.setValueMix=function(t){},l.apply3d=function(t,i,r,a,l){var s=t.getValue("bounds");t.addValue("color",this.data.getColor());var o=s.width,u=s.height;this._textureWidth=o,this._textureHeight=u;var c=g.create([t,i,r,0,0],e.tmpTarget);r.ctx.addRenderObject(c);var d,f=h.TEMP;return f.identity(),d=b.create(1,0),d.setFilters([this.data]),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"src",d,null,n.TOINT.overlay),c=g.create([t,i,r,0,0],e.startOut),r.ctx.addRenderObject(c),d=b.create(1,0),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"tmpTarget",d,y.INV_UV,n.TOINT.overlay),d=b.create(1,0),r.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,f,"src",d),c=g.create([t,i,r,0,0],e.recycleTarget),r.ctx.addRenderObject(c),null},l.setSpriteWH=function(t){this._textureWidth=t.width,this._textureHeight=t.height},l.setValue=function(t){t.u_offsetX=this.data.offX,t.u_offsetY=-this.data.offY,t.u_strength=1,t.u_blurX=this.data.blur,t.u_blurY=this.data.blur,t.u_textW=this._textureWidth,t.u_textH=this._textureHeight,t.u_color=this.data.getColor()},a(0,l,"typeMix",function(){return 8}),e.tmpTarget=function(t,e,i,r,a){var n=t.getValue("bounds");t.getValue("out").end();var l=f.create(n.width,n.height);l.start();var s=t.getValue("color");s&&l.clear(s[0],s[1],s[2],0),t.addValue("tmpTarget",l)},e.startOut=function(t,e,i,r,a){t.getValue("tmpTarget").end();var n=t.getValue("out");n.start();var l=t.getValue("color");l&&n.clear(l[0],l[1],l[2],0)},e.recycleTarget=function(t,e,i,r,a){t.getValue("src");t.getValue("tmpTarget").recycle()},e}(c);i.__init([w])}(window,document,Laya); -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/BackGround.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/BackGround.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/BackGround.png.bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/BackGround.png.bak.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/atlas/.rec: -------------------------------------------------------------------------------- 1 | D . 2 | D comp 3 | P D12221A9 bg.png 4 | P 9401CC40 blank.png 5 | P B03390E5 btn_close.png 6 | P 1F3929EA button.png 7 | P 6CC6DF97 checkbox.png 8 | P FB94CCF2 clip_num.png 9 | P F7B6B7D7 clip_selectBox.png 10 | P 755271AE clip_tree_arrow.png 11 | P 859FD34C clip_tree_folder.png 12 | P A0E3B8F9 combobox.png 13 | P 9EDA959E hscroll$bar.png 14 | P 1AB768D4 hscroll$down.png 15 | P 685261D3 hscroll$up.png 16 | P 274B8076 hscroll.png 17 | P E466EB1C hslider$bar.png 18 | P C4BECA54 hslider.png 19 | P 5EDC128C html.png 20 | P ACFFCCCF image.png 21 | P 5EDC128C label.png 22 | P 5EDC128C linkbutton.png 23 | P 9E4DD730 progress$bar.png 24 | P 3FD78E12 progress.png 25 | P BF898D6A radio.png 26 | P BF898D6A radiogroup.png 27 | P 8CFD9D35 tab.png 28 | P BDA71F88 textarea.png 29 | P BDA71F88 textinput.png 30 | P 52107B89 vscroll$bar.png 31 | P E26B933E vscroll$down.png 32 | P B9680947 vscroll$up.png 33 | P 7E990267 vscroll.png 34 | P E466EB1C vslider$bar.png 35 | P 2BFF7046 vslider.png 36 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/atlas/comp.atlas: -------------------------------------------------------------------------------- 1 | {"frames":{"image.png":{"frame":{"x":0,"y":0,"w":150,"h":250,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":150,"h":250}},"bg.png":{"frame":{"x":152,"y":0,"w":100,"h":79,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":79}},"clip_num.png":{"frame":{"x":0,"y":252,"w":240,"h":27,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":240,"h":27}},"combobox.png":{"frame":{"x":152,"y":81,"w":91,"h":69,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":69}},"tab.png":{"frame":{"x":242,"y":152,"w":70,"h":78,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":70,"h":78}},"button.png":{"frame":{"x":152,"y":152,"w":75,"h":69,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":75,"h":69}},"clip_selectBox.png":{"frame":{"x":245,"y":81,"w":100,"h":40,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":40}},"html.png":{"frame":{"x":245,"y":123,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"label.png":{"frame":{"x":152,"y":232,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"linkbutton.png":{"frame":{"x":242,"y":252,"w":120,"h":18,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":120,"h":18}},"textarea.png":{"frame":{"x":242,"y":272,"w":91,"h":23,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":23}},"textinput.png":{"frame":{"x":254,"y":0,"w":91,"h":23,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":91,"h":23}},"btn_close.png":{"frame":{"x":335,"y":272,"w":28,"h":60,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":28,"h":60}},"hscroll$bar.png":{"frame":{"x":314,"y":143,"w":21,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":21,"h":51}},"vscroll$bar.png":{"frame":{"x":337,"y":143,"w":17,"h":63,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":63}},"hscroll$down.png":{"frame":{"x":314,"y":196,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"hscroll$up.png":{"frame":{"x":347,"y":0,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"vscroll$down.png":{"frame":{"x":347,"y":53,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"vscroll$up.png":{"frame":{"x":254,"y":25,"w":17,"h":51,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":51}},"clip_tree_folder.png":{"frame":{"x":273,"y":25,"w":16,"h":48,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":16,"h":48}},"progress$bar.png":{"frame":{"x":291,"y":25,"w":50,"h":14,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":50,"h":14}},"progress.png":{"frame":{"x":291,"y":41,"w":50,"h":14,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":50,"h":14}},"hslider.png":{"frame":{"x":0,"y":281,"w":100,"h":6,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":100,"h":6}},"vslider.png":{"frame":{"x":356,"y":143,"w":6,"h":100,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":6,"h":100}},"checkbox.png":{"frame":{"x":333,"y":208,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"radio.png":{"frame":{"x":102,"y":281,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"radiogroup.png":{"frame":{"x":0,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"hslider$bar.png":{"frame":{"x":16,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"vslider$bar.png":{"frame":{"x":32,"y":289,"w":14,"h":42,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":42}},"hscroll.png":{"frame":{"x":274,"y":232,"w":33,"h":17,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":33,"h":17}},"vscroll.png":{"frame":{"x":48,"y":289,"w":17,"h":33,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":17,"h":33}},"clip_tree_arrow.png":{"frame":{"x":67,"y":289,"w":14,"h":28,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":14,"h":28}},"blank.png":{"frame":{"x":347,"y":106,"w":10,"h":10,"idx":0},"spriteSourceSize":{"x":0,"y":0},"sourceSize":{"w":10,"h":10}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"comp.png","prefix":"comp\/","md5":"054dc388a3e4a50802406d800fb20f7d"}} 2 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/atlas/comp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/atlas/comp.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/atlas/rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/atlas/rec -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/bird/bird_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/bird/bird_1.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/bird/bird_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/bird/bird_2.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/bird/bird_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/bird/bird_3.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/bird/bird_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/bird/bird_4.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/cat_sleep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/cat_sleep.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/effect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/effect.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/floor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/floor.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/hp/en_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/hp/en_bar.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/hp/hp_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/hp/hp_bar.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/hp/hp_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/hp/hp_bg.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/item/item_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/item/item_1.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/item/item_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/item/item_2.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/item/item_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/item/item_3.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/item/item_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/item/item_4.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/m_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/m_background.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/particle/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/particle/heart.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/particle/particle.part: -------------------------------------------------------------------------------- 1 | { 2 | "textureName":"res/particle/heart.png", 3 | "textureCount":1, 4 | "useEndRadian":true, 5 | "positionVariance":{ 6 | "2":0, 7 | "1":2, 8 | "0":2 9 | }, 10 | "minVerticalVelocity":0.1, 11 | "minVerticalStartRadian":-0, 12 | "minVerticalEndRadian":-6.283185307179586, 13 | "minStartSize":10, 14 | "minStartRadius":96, 15 | "minRotateSpeed":-2, 16 | "minHorizontalVelocity":0.1, 17 | "minHorizontalStartRadian":-0, 18 | "minHorizontalEndRadian":-6.283185307179586, 19 | "minEndSize":12, 20 | "minEndRadius":96, 21 | "minStartColor":{ 22 | "3":0.6000000238418579, 23 | "2":1, 24 | "1":0.30000001192092896, 25 | "0":1 26 | }, 27 | "minEndColor":{ 28 | "3":1, 29 | "2":1, 30 | "1":0, 31 | "0":0 32 | }, 33 | "maxVerticalVelocity":0.1, 34 | "maxVerticalStartRadian":0, 35 | "maxVerticalEndRadian":6.283185307179586, 36 | "maxStartSize":20, 37 | "maxStartRadius":96, 38 | "maxRotateSpeed":2, 39 | "maxPartices":1600, 40 | "maxHorizontalVelocity":0.1, 41 | "maxHorizontalStartRadian":0, 42 | "maxHorizontalEndRadian":6.283185307179586, 43 | "maxEndSize":40, 44 | "maxEndRadius":96, 45 | "maxStartColor":{ 46 | "3":1, 47 | "2":0, 48 | "1":0.30000001192092896, 49 | "0":1 50 | }, 51 | "maxEndColor":{ 52 | "3":1, 53 | "2":1, 54 | "1":0, 55 | "0":0 56 | }, 57 | "gravity":{ 58 | "2":0, 59 | "1":2, 60 | "0":0 61 | }, 62 | "endVelocity":1, 63 | "emitterVelocitySensitivity":1, 64 | "duration":6, 65 | "colorComponentInter":true, 66 | "blendState":1, 67 | "ageAddScale":1 68 | } -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player.atlas: -------------------------------------------------------------------------------- 1 | {"frames":{"chara_01.png":{"frame":{"x":0,"y":0,"w":45,"h":71,"idx":0},"spriteSourceSize":{"x":27,"y":23},"sourceSize":{"w":96,"h":96}},"chara_02.png":{"frame":{"x":47,"y":0,"w":52,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_03.png":{"frame":{"x":0,"y":73,"w":44,"h":73,"idx":0},"spriteSourceSize":{"x":28,"y":21},"sourceSize":{"w":96,"h":96}},"chara_04.png":{"frame":{"x":101,"y":0,"w":50,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_05.png":{"frame":{"x":46,"y":73,"w":53,"h":61,"idx":0},"spriteSourceSize":{"x":22,"y":16},"sourceSize":{"w":96,"h":96}},"chara_06.png":{"frame":{"x":153,"y":0,"w":52,"h":61,"idx":0},"spriteSourceSize":{"x":23,"y":16},"sourceSize":{"w":96,"h":96}},"chara_07.png":{"frame":{"x":207,"y":0,"w":54,"h":60,"idx":0},"spriteSourceSize":{"x":21,"y":17},"sourceSize":{"w":96,"h":96}},"chara_08.png":{"frame":{"x":101,"y":73,"w":54,"h":61,"idx":0},"spriteSourceSize":{"x":21,"y":16},"sourceSize":{"w":96,"h":96}},"chara_09.png":{"frame":{"x":0,"y":148,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":13},"sourceSize":{"w":96,"h":96}},"chara_10.png":{"frame":{"x":67,"y":136,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":21,"y":12},"sourceSize":{"w":96,"h":96}},"chara_11.png":{"frame":{"x":157,"y":63,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":11},"sourceSize":{"w":96,"h":96}},"chara_12.png":{"frame":{"x":224,"y":62,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":18,"y":13},"sourceSize":{"w":96,"h":96}},"chara_13.png":{"frame":{"x":127,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_14.png":{"frame":{"x":181,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_15.png":{"frame":{"x":235,"y":139,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_16.png":{"frame":{"x":235,"y":205,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"player.png","prefix":"","md5":"6cecff3fca089fbffaec581fc54f47fc"}} 2 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player.json: -------------------------------------------------------------------------------- 1 | {"frames":{"chara_01.png":{"frame":{"x":0,"y":0,"w":45,"h":71,"idx":0},"spriteSourceSize":{"x":27,"y":23},"sourceSize":{"w":96,"h":96}},"chara_02.png":{"frame":{"x":47,"y":0,"w":52,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_03.png":{"frame":{"x":0,"y":73,"w":44,"h":73,"idx":0},"spriteSourceSize":{"x":28,"y":21},"sourceSize":{"w":96,"h":96}},"chara_04.png":{"frame":{"x":101,"y":0,"w":50,"h":71,"idx":0},"spriteSourceSize":{"x":22,"y":23},"sourceSize":{"w":96,"h":96}},"chara_05.png":{"frame":{"x":46,"y":73,"w":53,"h":61,"idx":0},"spriteSourceSize":{"x":22,"y":16},"sourceSize":{"w":96,"h":96}},"chara_06.png":{"frame":{"x":153,"y":0,"w":52,"h":61,"idx":0},"spriteSourceSize":{"x":23,"y":16},"sourceSize":{"w":96,"h":96}},"chara_07.png":{"frame":{"x":207,"y":0,"w":54,"h":60,"idx":0},"spriteSourceSize":{"x":21,"y":17},"sourceSize":{"w":96,"h":96}},"chara_08.png":{"frame":{"x":101,"y":73,"w":54,"h":61,"idx":0},"spriteSourceSize":{"x":21,"y":16},"sourceSize":{"w":96,"h":96}},"chara_09.png":{"frame":{"x":0,"y":148,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":13},"sourceSize":{"w":96,"h":96}},"chara_10.png":{"frame":{"x":67,"y":136,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":21,"y":12},"sourceSize":{"w":96,"h":96}},"chara_11.png":{"frame":{"x":157,"y":63,"w":65,"h":78,"idx":0},"spriteSourceSize":{"x":17,"y":11},"sourceSize":{"w":96,"h":96}},"chara_12.png":{"frame":{"x":224,"y":62,"w":58,"h":75,"idx":0},"spriteSourceSize":{"x":18,"y":13},"sourceSize":{"w":96,"h":96}},"chara_13.png":{"frame":{"x":127,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_14.png":{"frame":{"x":181,"y":143,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_15.png":{"frame":{"x":235,"y":139,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}},"chara_16.png":{"frame":{"x":235,"y":205,"w":52,"h":64,"idx":0},"spriteSourceSize":{"x":21,"y":13},"sourceSize":{"w":96,"h":96}}},"meta":{"app":"http:\/\/www.layabox.com","version":"1.00","format":"json","scale":1,"image":"player.png","prefix":"","md5":"6cecff3fca089fbffaec581fc54f47fc"}} 2 | -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_01.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_02.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_03.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_04.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_05.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_06.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_07.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_08.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_09.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_10.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_11.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_12.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_13.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_14.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_15.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/player/chara_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/player/chara_16.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/rec -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/spiritEffect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/spiritEffect.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/tree0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/tree0.png -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/BG.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/BG.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/DecelerationCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/DecelerationCounting.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/InvincibleCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/InvincibleCounting.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/Invincible_end.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/Invincible_end.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/Invincible_start.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/Invincible_start.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/LowerSpeed.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/LowerSpeed.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/res/wav/StarCounting.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/release/layaweb/1.0.0/res/wav/StarCounting.wav -------------------------------------------------------------------------------- /release/layaweb/1.0.0/unpack.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /src/Config.js: -------------------------------------------------------------------------------- 1 | //定义背景的大小 2 | var BG_WIDTH = 800; 3 | var BG_HEIGHT = 480; 4 | //地板大小 5 | var FLOOR_HEIGHT = 84; 6 | var FLOOR_WIDTH = 960; 7 | //人物大小 8 | var PLAYER_WIDTH = 96; 9 | var PLAYER_HEIGHT = 96; 10 | //能量条背景大小 11 | var ENERGY_BG_BAR_WIDTH = 180; 12 | var ENERGY_BG_BAR_HEIGHT = 21; 13 | //能量条大小 14 | var ENERGY_BAR_WIDTH = 155; 15 | var ENERGY_BAR_HEIGHT = 12; 16 | //物品-星星大小 17 | var ITEM_STAR_WIDTH = 32; 18 | var ITEM_STAR_HEIGHT = 32; 19 | //物品-星星出现几率 20 | var ITEM_STAR_PROBABILITY = 0.8; 21 | //物品-减速道具大小 22 | var ITEM_DECELERATION_WIDTH = 40; 23 | var ITEM_DECELERATION_HEIGHT = 53; 24 | //物品-减速道具出现几率 25 | var ITEM_DECELERAYION_PROBABILITY = 0.1; 26 | //物品-无敌道具大小 27 | var ITEM_INVINCIBLE_WIDTH = 40; 28 | var ITEM_INVINCIBLE_HEIGHT = 48; 29 | //物品-无敌道具出现几率 30 | var ITEM_INVINCIBLE_PROBABILITY = 0.08; 31 | 32 | //npc大小 33 | var NPC_BIRD_WIDTH = 96; 34 | var NPC_BIRD_HEIGHT = 96; 35 | //NPC出现几率 36 | var NPC_BIRD_PROBABLITY = 0.1; 37 | //npc间隔 38 | var NPC_BIRD_INTANCE = 200; 39 | 40 | //无敌状态下能量条下降速度 41 | var ITEM_INVINCIBLE_DESCENT_SPEED = 0.20; 42 | //减速能量条下降速度 43 | var ITEM_DECELERATION_DESCENT_SPEED = 0.8; 44 | 45 | //背景移动速度 46 | var BG_SPEED = 3; 47 | //背景的帧处理间隔 48 | var BG_FRAME_DELAY = 1; 49 | 50 | //人物的奔跑速度设置是在地板移动速度那里. 51 | //人物帧处理间隔 52 | var PLAYER_FRAME_DELAY = 1; 53 | //人物奔跑频率,值越大看起来越慢 54 | var PLAYER_RUN_SPEED_DEFAULT = 190; 55 | var PLAYER_RUN_SPEED = PLAYER_RUN_SPEED_DEFAULT; 56 | //人物下落初始变量 57 | var PLAYER_DOWN_VY = 0; 58 | //人物下落速度 59 | var PLAYER_DOWN_SPEED = 2; 60 | //人物最大下落值 61 | var PLAYER_DOWN_MAX_SPEED = 32; 62 | 63 | //Npc播放频率,值越大看起来越慢 64 | var NPC_BIRD_INTERVAL = 100; 65 | 66 | //地板移动速度 67 | var FLOOR_SPEED_DEFAULT = 3.2; 68 | var FLOOR_SPEED = 3.2; 69 | var FLOOR_SPEED_MAX = 10; 70 | var FLOOR_SPEED_FASTER_STEP = 0.001; 71 | var IS_FLOOR_SPEED_MAX = false; 72 | //地板的帧处理间隔 73 | var FLOOR_FRAME_DELAY = 1; 74 | 75 | //地板管理器的帧处理间隔 76 | var MAP_FLOOR_FRAME_DELAY = 10; 77 | 78 | //能量条最小值 79 | var ENERGY_BAR_MIN_VALUE = 0; 80 | //能量条最大值 81 | var ENERGY_BAR_MAX_VALUE = 100; 82 | //能量条背景位置 83 | var ENERGY_BAR_X = 15; 84 | var ENERGY_BAR_Y = 2; 85 | 86 | //物品出现在地板上的间隔 87 | var ITEMNUM_ON_FLOOR = 2; 88 | //NPC在地板上出现的间隔 89 | var NPC_BIRD_NUM_ON_FLOOR = 2; 90 | 91 | //分数栏 92 | var SCORETEXT_COLOR = "#FFFFFF";//颜色 93 | var SCORETEXT_FONT_SIZE = 30;//字体大小 94 | var SCORETEXT_TEXT_DEFAULT = 0;//默认文字 95 | var SCORETEXT_ALIGN = "right";// "left": 居左对齐显示。 "center": 居中对齐显示。 "right": 居右对齐显示。 96 | 97 | //游戏相关状态 98 | var IS_PAUSE = false; 99 | var IS_OVER = false; 100 | 101 | var BG_MUSIC_VOLUME = 0.5; 102 | 103 | 104 | var Sprite = laya.display.Sprite; 105 | var Handler = laya.utils.Handler; 106 | var Animation = laya.display.Animation; 107 | var SoundManager = laya.media.SoundManager; 108 | var Pool = laya.utils.Pool; 109 | var Text = laya.display.Text; 110 | var Tween = laya.utils.Tween; 111 | 112 | if( window.conch ) 113 | { 114 | //值为1:表示所有LOGE全部弹出alert 115 | //值为2:表示所有LOGE和LOGW全部弹出alert 116 | window.conch.config.setDebugLevel(2); 117 | } -------------------------------------------------------------------------------- /src/init.js: -------------------------------------------------------------------------------- 1 | /*这里面只用于laya引擎初始化和图片加载功能 其他不管 */ 2 | //laya初始化 3 | Laya.init(BG_WIDTH, BG_HEIGHT, Laya.WebGL); 4 | //FPS 5 | // Laya.Stat.show(0, 0); 6 | //设置适配模式 7 | Laya.stage.scaleMode = "exactfit"; 8 | //设置居中对齐 9 | Laya.stage.alignH = "center"; 10 | //设置横屏 11 | Laya.stage.screenMode = "none"; 12 | //设置分辨率 13 | Laya.stage.scaleMode = "showall"; 14 | 15 | //loading 16 | var loading = new Loading(); 17 | Laya.stage.addChild(loading); 18 | 19 | this.runGame = null; 20 | 21 | //游戏介绍 22 | var gameInfo = new GameInfo(); 23 | 24 | //加载单个资源 25 | var asset = []; 26 | asset.push({ 27 | url: [ 28 | "res/BackGround.png", 29 | "res/tree0.png", 30 | "res/floor.png", 31 | "res/cat_sleep.png", 32 | "res/bird/bird_1.png", 33 | "res/bird/bird_2.png", 34 | "res/bird/bird_3.png", 35 | "res/bird/bird_4.png", 36 | "res/item/item_1.png", 37 | "res/item/item_2.png", 38 | "res/item/item_3.png", 39 | "res/item/item_4.png", 40 | "res/hp/hp_bg.png", 41 | "res/hp/hp_bar.png", 42 | "res/hp/en_bar.png", 43 | "res/effect.png", 44 | "res/particle/heart.png" 45 | ], 46 | type: Laya.Loader.IMAGE 47 | }); 48 | 49 | //加载图集资源 50 | asset.push({ 51 | url: "res/player.json", 52 | type: Laya.Loader.ATLAS 53 | }); 54 | 55 | //加载资源 56 | Laya.loader.load(asset, Handler.create(this, onLoaded), Handler.create(this, onLoading, null, false)); 57 | 58 | 59 | //加载进度 60 | function onLoading(progress) { 61 | console.log("正在加载,加载进度: " + progress + "\n"); 62 | loading.progress(progress); 63 | } 64 | 65 | //加载完成 66 | function onLoaded() { 67 | console.log("图片资源加载完毕\n"); 68 | //开始渲染游戏 69 | Laya.stage.renderingEnabled=true; 70 | //加载完毕移除loading 显示游戏提示UI 并且初始化游戏 71 | Laya.stage.removeChild(loading); 72 | //实例化RunGame 73 | var runGame = new RunGame(); 74 | this.runGame = runGame; 75 | //把RunGame添加到舞台上 76 | Laya.stage.addChild(runGame); 77 | Laya.stage.addChild(gameInfo); 78 | 79 | } 80 | 81 | function initGame(isRestartGame){ 82 | gameInfo.init("游戏已结束!请重新开始游戏!"); 83 | Laya.stage.removeChildren(this.runGame); 84 | onLoaded(); 85 | } 86 | -------------------------------------------------------------------------------- /src/runGame/BackGround.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 背景类 4 | */ 5 | 6 | function BackGround() { 7 | //自定义背景1 8 | this.bg1 = null; 9 | //自定义背景2 10 | this.bg2 = null; 11 | //树木 12 | this.tree = null; 13 | //cat 14 | this.cat = null; 15 | 16 | 17 | BackGround.__super.call(this); 18 | this.init(); 19 | } 20 | 21 | //注册这个类 22 | Laya.class(BackGround, "BackGround", Sprite); 23 | 24 | //拿到原型 25 | var _proto = BackGround.prototype; 26 | 27 | _proto.init = function () { 28 | var texture1 = Laya.loader.getRes("res/BackGround.png"); 29 | var texture2 = Laya.loader.getRes("res/BackGround.png"); 30 | var textureTree = Laya.loader.getRes("res/tree0.png"); 31 | var textureCat = Laya.loader.getRes("res/m_background.png"); 32 | //播放背景音乐 33 | //背景音乐同时只能播放一个, 34 | //如果在播放背景音乐时再次调用本方法, 35 | //会先停止之前的背景音乐,再播放当前的背景音乐。 36 | //也就是说,这个方法只能用于背景音乐 37 | Laya.SoundManager.musicVolume = BG_MUSIC_VOLUME; 38 | Laya.SoundManager.playMusic("res/wav/BG.wav",0); 39 | //创建背景1 40 | this.bg1 = new Sprite(); 41 | //绘制背景图1 42 | this.bg1.graphics.drawTexture(texture1, 0, 0); 43 | //把背景1添加到当前容器对象里 44 | this.addChild(this.bg1); 45 | 46 | //创建背景2 47 | this.bg2 = new Sprite(); 48 | //绘制背景图2 49 | this.bg2.graphics.drawTexture(texture2, 0, 0); 50 | //把背景1添加到当前容器对象里 51 | this.addChild(this.bg2); 52 | //把第二个背景放到第一个背景后面紧跟着 53 | this.bg2.pos(BG_WIDTH, 0); 54 | 55 | //前景图片树木 56 | this.tree = new Sprite(); 57 | //绘制树木 58 | this.tree.graphics.drawTexture(textureTree, 0, 0); 59 | 60 | this.addChild(this.tree); 61 | 62 | this.tree.pos(BG_WIDTH, 64); 63 | 64 | //绘制猫 65 | this.cat = new Sprite(); 66 | 67 | this.cat.graphics.drawTexture(textureCat,0,0,64,64); 68 | 69 | this.addChild(this.cat); 70 | 71 | 72 | //创建一个帧循环处理函数,用于背景位置的更新,实现背景滚动效果。 73 | Laya.timer.frameLoop(BG_FRAME_DELAY, this, this.onLoop) 74 | 75 | } 76 | 77 | _proto.onLoop = function () { 78 | if(IS_PAUSE || IS_OVER){return;} 79 | 80 | //移动 81 | this.x -= BG_SPEED; 82 | 83 | //当背景1向左移动出游戏的显示区域,则将背景1的x轴坐标,向右移动*2. 84 | if (this.bg1.x + this.x <= -BG_WIDTH) { 85 | this.bg1.x += BG_WIDTH * 2; 86 | } 87 | //当背景2向左移动出游戏的显示区域,则将背景2的x轴坐标,向右移动*2. 88 | if (this.bg2.x + this.x <= -BG_WIDTH) { 89 | this.bg2.x += BG_WIDTH * 2; 90 | } 91 | //树木移动 92 | if (this.tree.x + this.x <= -BG_WIDTH) { 93 | this.tree.x += BG_WIDTH * 2; 94 | } 95 | //cat移动 96 | if (this.cat.x + this.x <= -BG_WIDTH) { 97 | this.cat.x += BG_WIDTH * 2; 98 | } 99 | } 100 | 101 | 102 | })(); -------------------------------------------------------------------------------- /src/runGame/EnergyBar.js: -------------------------------------------------------------------------------- 1 | //这里面包含了生命条和无敌状态能量条 2 | 3 | (function () { 4 | /** 5 | * 能量条,包含生命条和无敌状态能量条 6 | */ 7 | function EnergyBar(type) { 8 | //背景 9 | this.bg = null; 10 | //进度条 11 | this.bar = null; 12 | //最小值 13 | this.minValue = ENERGY_BAR_MIN_VALUE; 14 | //最大值 15 | this.maxValue = ENERGY_BAR_MAX_VALUE; 16 | //残影 17 | this.bodyEffect1 = null; 18 | this.bodyEffect2 = null; 19 | //特效 20 | this.spiritEffect = null; 21 | //当前值 22 | this.value = 0; 23 | EnergyBar.__super.call(this); 24 | 25 | this.SoundManager = laya.media.SoundManager; 26 | this.init(type); 27 | } 28 | 29 | //能量类型 30 | EnergyBar.TYPE_DECELERATION = "Deceleration";//减速 31 | EnergyBar.TYPE_INVINCIBLE = "Invincible";//无敌 32 | 33 | //注册 34 | Laya.class(EnergyBar, "EnergyBar", Sprite); 35 | 36 | var _proto = EnergyBar.prototype; 37 | 38 | _proto.init = function (type) { 39 | this.width = ENERGY_BG_BAR_WIDTH; 40 | this.height = ENERGY_BG_BAR_HEIGHT; 41 | //能量/血条背景 42 | var textureEnergyBarBG = Laya.loader.getRes("res/hp/hp_bg.png"); 43 | //这个会选择性加载能量条还是血条 44 | var textureEnergyBarType = null; 45 | //选择加载能量条还是血条 46 | switch (type) { 47 | //能量条 48 | case EnergyBar.TYPE_DECELERATION: 49 | textureEnergyBarType = Laya.loader.getRes("res/hp/en_bar.png"); 50 | break; 51 | //血条 52 | case EnergyBar.TYPE_INVINCIBLE: 53 | textureEnergyBarType = Laya.loader.getRes("res/hp/hp_bar.png"); 54 | break; 55 | } 56 | 57 | this.bg = new Sprite(); 58 | this.bar = new Sprite(); 59 | this.bar.x = ENERGY_BAR_X; 60 | this.bar.y = ENERGY_BAR_Y; 61 | 62 | this.bar.scale(this.value / this.maxValue,1); 63 | 64 | //绘制血条和能量条 65 | this.bg.graphics.drawTexture(textureEnergyBarBG, 0, 0, ENERGY_BG_BAR_WIDTH, ENERGY_BG_BAR_HEIGHT); 66 | this.bar.graphics.drawTexture(textureEnergyBarType, 0, 0, ENERGY_BAR_WIDTH, ENERGY_BAR_HEIGHT); 67 | 68 | this.addChild(this.bg); 69 | this.addChild(this.bar); 70 | } 71 | 72 | _proto.updateEnergyValue = function(value){ 73 | this.value = value; 74 | if(this.value > this.maxValue){this.value = this.maxValue} 75 | if(this.value < this.minValue){this.value = this.minValue} 76 | this.bar.scale(this.value / this.maxValue,1); 77 | } 78 | 79 | _proto.addEnergyValue = function(value){ 80 | this.value += value; 81 | this.updateEnergyValue(this.value); 82 | } 83 | 84 | })(); -------------------------------------------------------------------------------- /src/runGame/Floor.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 地板类 4 | */ 5 | function Floor() { 6 | 7 | //背景贴图 8 | this.bgTexture = null; 9 | //背景 10 | this.bg = null; 11 | //最大右边距离 12 | this.maxRight = 0; 13 | //是否完全出屏幕 14 | this.isOutComplete = false; 15 | //背景右边补丁 16 | this.rightBg = null; 17 | //当前地板上的物品的集合 18 | this.itemList = []; 19 | //当前地板上的Npc的集合 20 | this.birdList = []; 21 | //计时器,用于加快地板速度 22 | this.timer = null; 23 | 24 | Floor.__super.call(this); 25 | } 26 | 27 | //事件名称:OUT_COMPLETE 28 | //超过一定屏幕触发floor的OUT_COMPLETE事件 29 | Floor.OUT_COMPLETE = "floor_out_complete"; 30 | //整个地板都不在屏幕里面事件 31 | Floor.OUT_DIE = "floor_out_die"; 32 | 33 | //注册这个类 34 | Laya.class(Floor, "Floor", Sprite); 35 | 36 | var _proto = Floor.prototype; 37 | 38 | _proto.init = function (type) { 39 | /** 40 | * 初始化Floor 41 | */ 42 | //是否需要在地板上增加道具 43 | var isNeedItem = true; 44 | //如果不开启autoSize 父容器的宽度和高度无法获取 45 | this.autoSize = true; 46 | //初始化的时候将坐标放到屏幕右边 47 | this.x = BG_WIDTH; 48 | //应该把地板放在屏幕中间 49 | this.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2; 50 | 51 | if (this.bg == null) { 52 | //贴图纹理 53 | this.bgTexture = Laya.loader.getRes("res/floor.png"); 54 | this.bg = new Sprite(); 55 | //清空绘制 56 | this.bg.graphics.clear(); 57 | 58 | this.addChild(this.bg); 59 | } 60 | //绘制地板 61 | this.bg.graphics.drawTexture(this.bgTexture, 0, 0) 62 | 63 | if(isNeedItem){this.addItem();} 64 | this.addBird(); 65 | //创建一个帧循环处理函数 66 | Laya.timer.frameLoop(FLOOR_FRAME_DELAY, this, this.onLoop); 67 | } 68 | 69 | _proto.onLoop = function () { 70 | if(IS_PAUSE || IS_OVER) {return}; 71 | /** 72 | * 帧循环处理函数 73 | */ 74 | 75 | //让地板的速度和移动比背景快一点 76 | this.x -= FLOOR_SPEED; 77 | 78 | //地板的速度不断是累加的,最大是FLOOR_SPEED_MAX 79 | if(!IS_FLOOR_SPEED_MAX){this.moveFaster();} 80 | 81 | //判断是否出了边界 如果出了 就通知生成新的floor 这里增加一个变量来判断当前是否已经通知外部了 82 | if (!this.isOutComplete && (this.x + BG_WIDTH) < FLOOR_WIDTH) { 83 | 84 | this.isOutComplete = true; 85 | 86 | this.event(Floor.OUT_COMPLETE, this); 87 | 88 | } else if ((this.x + BG_WIDTH + FLOOR_WIDTH) < 0) { 89 | //判断整个floor是否不在屏幕里面了 如果不在了 移除当前floor 90 | Laya.timer.clear(this, this.onLoop); 91 | //如果有物品先隐藏 92 | for(var i = 0; i < this.itemList.length; i++){ 93 | // this.itemList[i].visible = false; 94 | } 95 | this.visible = false; 96 | this.event(Floor.OUT_DIE, this); 97 | 98 | } 99 | 100 | } 101 | 102 | /** 103 | * 允许在地板上添加物品 104 | */ 105 | _proto.addItem = function () { 106 | //创建一个随机数 107 | var randomNumber = parseInt(Math.random() * 10); 108 | //如果随机数小于五,不添加,因为会造成道具太多的问题 109 | if(randomNumber < 1) return; 110 | //需要添加的数量 111 | var addNum = 0; 112 | //计算道具的最大数量,现在强制道具的宽度都是32 113 | var maxItemNum = Math.floor( FLOOR_WIDTH / 32); 114 | //定制数量的规则 115 | if(maxItemNum >= 5){ 116 | addNum = 5 + Math.floor((maxItemNum - 5) * Math.random());; 117 | }else{ 118 | addNum = maxItemNum; 119 | } 120 | //计算居中的点 121 | var sx = FLOOR_WIDTH / addNum; 122 | var arr = []; 123 | var isHasSpecialItem = false; 124 | for(var i = 0;i 0 ){ 130 | item = this.itemList.shift();//shift() 方法用于把数组的第一个元素从其中删除,并返回第一个元素的值。 131 | item.visible = true; 132 | }else{ 133 | //从对象池中获取item 134 | var item = Pool.getItemByClass("Item",Item); 135 | } 136 | 137 | if(randomNumber >= 1-ITEM_INVINCIBLE_PROBABILITY ){ 138 | isHasSpecialItem = true; 139 | item.init(Item.ITEM_TYPE_INCINCIBLE);//无敌 140 | }else if(randomNumber >= 1-ITEM_DECELERAYION_PROBABILITY){ 141 | isHasSpecialItem = true; 142 | item.init(Item.ITEM_TYPE_DECELERATION);//减速 143 | }else if(randomNumber >= 1-ITEM_STAR_PROBABILITY){ 144 | isHasSpecialItem = true; 145 | item.init(Item.ITEM_TYPE_STAR);//星星,加分道具 146 | }else{ 147 | 148 | } 149 | item.x = sx + i * 32; 150 | item = item.randomItemPosition(item);//已经设置好了y值 151 | 152 | this.addChild(item); 153 | arr.push(item); 154 | } 155 | this.itemList = [].concat(arr) 156 | } 157 | 158 | /** 159 | * 获取当前当前地板上的所有物品 160 | */ 161 | _proto.getAllItems = function () { 162 | return this.itemList; 163 | } 164 | 165 | //放置npc 166 | _proto.addBird = function(){ 167 | //创建一个随机数 168 | var randomNumber = parseInt(Math.random() * 10); 169 | //如果随机数小于五,不添加,因为会造成npc太多的问题 170 | if(randomNumber < 5) return; 171 | //需要添加的数量 172 | var addNum = 0; 173 | //计算道具的最大数量 174 | var maxBirdNum = Math.floor( FLOOR_WIDTH / NPC_BIRD_INTANCE); 175 | //定制数量的规则 176 | if(maxBirdNum >= 5){ 177 | addNum = 5 + Math.floor((maxBirdNum - 5) * Math.random());; 178 | }else{ 179 | addNum = maxBirdNum; 180 | } 181 | //计算居中的点 182 | var sx = FLOOR_WIDTH / addNum; 183 | var arr = []; 184 | for(var i = 0;i 0 ){ 190 | bird = this.this.birdList.shift();//shift() 方法用于把数组的第一个元素从其中删除,并返回第一个元素的值。 191 | bird.visible = true; 192 | }else{ 193 | //从对象池中获取Npc 194 | var bird = Pool.getItemByClass("Npc",Npc); 195 | } 196 | if(randomNumber >= 1 - NPC_BIRD_PROBABLITY){ 197 | // console.log("randomNumber = " + randomNumber); 198 | bird.init(); 199 | } 200 | bird.x = sx + i * 128; 201 | bird = bird.randomNpcPosition(bird);//已经设置好了y值 202 | // console.log("bird.x="+bird.x + " bird.y=" + bird.x );.... 203 | 204 | this.addChild(bird); 205 | arr.push(bird); 206 | } 207 | this.birdList = [].concat(arr) 208 | } 209 | 210 | /** 211 | * 获取当前当前地板上的所有物品 212 | */ 213 | _proto.getAllNpcs = function () { 214 | return this.birdList; 215 | } 216 | 217 | //加快地板移动速度 218 | _proto.moveFaster = function(){ 219 | if(FLOOR_SPEED >= FLOOR_SPEED_MAX){ 220 | IS_FLOOR_SPEED_MAX = true; 221 | return; 222 | } 223 | window.clearTimeout(this.timer); 224 | FLOOR_SPEED += FLOOR_SPEED_FASTER_STEP; 225 | this.timer = window.setTimeout(this.moveFaster,100); 226 | } 227 | 228 | //减小地板移动速度 229 | _proto.moveLower = function(father){ 230 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 231 | IS_FLOOR_SPEED_MAX = false; 232 | father.player.isInLowerSpeed = false; 233 | father.player.decelerationEnergy.updateEnergyValue(0); 234 | return; 235 | } 236 | /** 237 | * 碰撞检测 238 | * @param x 239 | * @param y 240 | * @param playerStatus:"up" ? "down" 241 | */ 242 | _proto.checkHit = function (playerX, playerY, playerStatus) { 243 | /* 244 | 玩家在上方: 245 | 玩家的Y轴 < (地板Y+FLOOR_HEIGHT) 246 | 玩家Y > 地板Y 247 | 248 | 玩家在下方: 249 | 玩家的Y轴 > (地板Y+FLOOR_HEIGHT) 250 | 玩家Y < 地板Y 251 | */ 252 | if (playerY > this.y && playerY < (this.y + FLOOR_HEIGHT) && playerStatus == "up") { return true; } 253 | else if (playerY < this.y && playerY > (this.y + FLOOR_HEIGHT) && playerStatus == "down") { return true; } 254 | else { return false; } 255 | } 256 | })(); -------------------------------------------------------------------------------- /src/runGame/GameInfo.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | /** 4 | * 游戏介绍 5 | */ 6 | function GameInfo(){ 7 | this.bg = null; 8 | this.txt = null; 9 | GameInfo.__super.call(this); 10 | var message = null; 11 | this.init(message); 12 | } 13 | //GameInfo 14 | Laya.class(GameInfo,"GameInfo", laya.display.Sprite); 15 | 16 | var _proto = GameInfo.prototype; 17 | 18 | _proto.init = function(message){ 19 | this.width = BG_WIDTH; 20 | this.height = BG_HEIGHT; 21 | 22 | //暂停游戏 23 | IS_PAUSE = true; 24 | //黑色背景 25 | this.bg = new Sprite(); 26 | this.bg.alpha = 0.8; 27 | this.bg.graphics.drawRect(0,0,BG_WIDTH,BG_HEIGHT,"#000000"); 28 | this.addChild(this.bg); 29 | 30 | //loading文本 31 | this.txt = new Text(); 32 | this.txt.color = "#ffffff"; 33 | this.txt.fontSize = 20; 34 | if((message == "") || (message == null)){ 35 | this.txt.text = "游戏介绍\n\n点击可控制人物翻转\n\n左上角紫色条代表当前启动无敌状态 黄色条代表减速速状态\n\n\n好了 点击屏幕开始狂奔之旅吧~~"; 36 | }else{ 37 | this.txt.text = message; 38 | } 39 | this.txt.width = BG_WIDTH; 40 | this.txt.align = "center"; 41 | this.txt.y = (BG_HEIGHT - this.txt.height) * 0.5; 42 | this.addChild(this.txt); 43 | 44 | } 45 | 46 | 47 | })(); -------------------------------------------------------------------------------- /src/runGame/Item.js: -------------------------------------------------------------------------------- 1 | //这是各种图标 2 | (function () { 3 | /** 4 | * 物品类 5 | */ 6 | function Item() { 7 | //图标 8 | this.icon = null; 9 | //星星图标[普通积分道具] 10 | this.starTexture = null; 11 | //减速图标 12 | this.decelerationTexure = null; 13 | //无敌图标 14 | this.invincibleTexture = null; 15 | //图表类型[ITEM_TYPE_STAR ? ITEM_TYPE_DECELERATION ? ITEM_TYPE_INVINCIBLE] 16 | this.type = ""; 17 | this.directionStatus = "up"; 18 | 19 | Item.__super.call(this); 20 | } 21 | 22 | /*类型分类*/ 23 | //星星 24 | Item.ITEM_TYPE_STAR = "ITEM_TYPE_STAR"; 25 | //减速 26 | Item.ITEM_TYPE_DECELERATION = "ITEM_TYPE_DECELERATION"; 27 | //无敌 28 | Item.ITEM_TYPE_INCINCIBLE = "ITEM_TYPE_INVINCIBLE"; 29 | 30 | //注册这个类 31 | Laya.class(Item, "Item", laya.display.Sprite); 32 | 33 | //获取原型 34 | _proto = Item.prototype; 35 | //播放星星的碰撞效果 36 | _proto.TweenStar = function(item){Tween.to(item, {y : -5, scaleX : 0.1, alpha : 0}, 200, null, Handler.create(this, this.undefinedFunc, [item]));} 37 | //随机物品的上下位置 38 | _proto.randomItemPosition = function(item){ 39 | var randomNumber = parseInt(100*Math.random()); 40 | if(randomNumber <= 50){ 41 | //把道具放在上面 42 | item.directionStatus = "up"; 43 | item.y = -30; 44 | }else{ 45 | //把道具放在下面,并倒置 46 | item.directionStatus = "down"; 47 | item.y = FLOOR_HEIGHT + 50; 48 | //水平倾斜角度,默认值为0。以角度为单位 49 | item.skewX = 180; 50 | //垂直倾斜角度,默认值为0。以角度为单位。 51 | item.skewY = 180; 52 | //镜像翻转 53 | item.scaleX = -1; 54 | } 55 | return item; 56 | } 57 | _proto.init = function (type) { 58 | this.type = type; 59 | if (this.icon == null) { 60 | /*加载图集资源*/ 61 | this.starTexture = Laya.loader.getRes("res/item/item_1.png"); 62 | this.decelerationTexure = Laya.loader.getRes("res/item/item_3.png"); 63 | this.invincibleTexture = Laya.loader.getRes("res/item/item_4.png"); 64 | this.icon = new Sprite(); 65 | } 66 | this.icon.graphics.clear(); 67 | switch (type) { 68 | case Item.ITEM_TYPE_STAR: 69 | this.icon.graphics.drawTexture(this.starTexture,0,0,ITEM_STAR_WIDTH,ITEM_STAR_HEIGHT); 70 | break; 71 | case Item.ITEM_TYPE_DECELERATION: 72 | this.icon.graphics.drawTexture(this.decelerationTexure,0,0,ITEM_DECELERATION_WIDTH,ITEM_DECELERATION_HEIGHT); 73 | break; 74 | case Item.ITEM_TYPE_INCINCIBLE: 75 | this.icon.graphics.drawTexture(this.invincibleTexture,0,0,ITEM_INVINCIBLE_WIDTH,ITEM_INVINCIBLE_HEIGHT); 76 | break; 77 | default: 78 | alert("道具指令错误!"); 79 | break; 80 | } 81 | this.addChild(this.icon); 82 | } 83 | 84 | })(); -------------------------------------------------------------------------------- /src/runGame/Loading.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | /** 4 | * 加载类 5 | */ 6 | function Loading(){ 7 | this.bg = null; 8 | this.txt = null; 9 | Loading.__super.call(this); 10 | this.init(); 11 | } 12 | //Loading 13 | Laya.class(Loading,"Loading", laya.display.Sprite); 14 | 15 | var _proto = Loading.prototype; 16 | 17 | _proto.init = function(){ 18 | 19 | //黑色背景 20 | this.bg = new Sprite(); 21 | this.bg.graphics.drawRect(0,0,BG_WIDTH,BG_HEIGHT,"#000000"); 22 | this.addChild(this.bg); 23 | 24 | //loading文本 25 | this.txt = new Text(); 26 | this.txt.color = "#ffffff"; 27 | this.txt.fontSize = 30; 28 | this.txt.text = "Loading......"; 29 | this.txt.width = BG_WIDTH; 30 | this.txt.align = "center"; 31 | this.txt.y = (BG_HEIGHT - this.txt.height) * 0.5; 32 | this.addChild(this.txt); 33 | 34 | } 35 | _proto.progress = function(value){ 36 | this.txt.text = "Loading " + parseInt(value * 100) + "%"; 37 | } 38 | 39 | })(); -------------------------------------------------------------------------------- /src/runGame/MapFloor.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 地板地图管理类 4 | */ 5 | function MapFloor() { 6 | 7 | //要移除的地板 8 | this.dieFloorList = []; 9 | 10 | MapFloor.__super.call(this); 11 | 12 | this.init(); 13 | } 14 | 15 | //注册MapFloor 16 | Laya.class(MapFloor, "MapFloor", Sprite); 17 | 18 | var _proto = MapFloor.prototype; 19 | 20 | _proto.init = function () { 21 | 22 | var floor = this.addFloor(); 23 | //避免玩家最开始没有地板可以踩 24 | floor.x = 0; 25 | //创建一个帧循环函数 26 | Laya.timer.frameLoop(MAP_FLOOR_FRAME_DELAY, this, this.onLoop); 27 | 28 | } 29 | 30 | _proto.onLoop = function () { 31 | /** 32 | * 帧循环处理 33 | */ 34 | 35 | //监听有没有地板要移除 36 | while (this.dieFloorList.lenght > 0) { 37 | var floor = this.dieFloorList.shift(); 38 | floor.removeSelf(); 39 | //回收 40 | Pool.recover("floor",floor) 41 | 42 | } 43 | } 44 | 45 | _proto.addFloor = function () { 46 | /** 47 | * 增加地板 48 | */ 49 | 50 | var floor = Pool.getItemByClass("floor",Floor) 51 | 52 | floor.init(); 53 | floor.once(Floor.OUT_COMPLETE, this, this.getFloor); 54 | floor.once(Floor.OUT_DIE, this, this.delFloor); 55 | this.addChild(floor); 56 | return floor; 57 | } 58 | 59 | _proto.getFloor = function (floor) { 60 | /** 61 | * 获取地板 62 | */ 63 | this.addFloor(); 64 | } 65 | 66 | _proto.delFloor = function (floor) { 67 | /** 68 | * 删除地板 69 | */ 70 | this.dieFloorList.push(floor); 71 | } 72 | 73 | })(); -------------------------------------------------------------------------------- /src/runGame/Npc.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | /** 3 | * NPC 4 | */ 5 | function Npc(){ 6 | this.body = null; 7 | Npc.__super.call(this); 8 | this.init(); 9 | } 10 | 11 | //NPC注册 12 | Laya.class(Npc,"Npc",Sprite); 13 | 14 | //获取原型 15 | var _proto = Npc.prototype; 16 | Npc.cached = false; 17 | Npc.BIRD = "bird"; 18 | this.type = ""; 19 | Npc.NPC_TYPE_BIRD = "NPC_TYPE_BIRD"; 20 | 21 | _proto.init = function(){ 22 | 23 | //缓存动画 24 | if(!Npc.cached){ 25 | Npc.cached = true; 26 | Animation.createFrames(['res/bird/bird_1.png','res/bird/bird_2.png','res/bird/bird_3.png','res/bird/bird_4.png'], Npc.BIRD); 27 | } 28 | //创建Npc 29 | if(this.body == null){ 30 | this.body = new Animation(); 31 | this.body.interval = NPC_BIRD_INTERVAL; 32 | this.type = Npc.NPC_TYPE_BIRD; 33 | this.addChild(this.body); 34 | this.body.play(0, true, Npc.BIRD); 35 | //创建一个帧循环处理函数 36 | Laya.timer.frameLoop(1, this, this.onLoop); 37 | } 38 | 39 | } 40 | //帧循环函数 41 | _proto.onLoop = function(){ 42 | if(IS_OVER)return; 43 | if(this.body.x < -100){ 44 | this.removeSelf(); 45 | //回收 46 | Pool.recover("Npc",this); 47 | Laya.timer.clear(this, this.onLoop); 48 | } 49 | } 50 | //随机物品的上下位置 51 | _proto.randomNpcPosition = function(bird){ 52 | var randomNumber = parseInt(100*Math.random()); 53 | if(randomNumber <= 50){ 54 | //把道具放在上面 55 | bird.directionStatus = "up"; 56 | bird.y = -NPC_BIRD_HEIGHT/2; 57 | }else{ 58 | //把道具放在下面,并倒置 59 | bird.directionStatus = "down"; 60 | bird.y = FLOOR_HEIGHT + (NPC_BIRD_HEIGHT/3)*2; 61 | //水平倾斜角度,默认值为0。以角度为单位 62 | bird.skewX = 180; 63 | //垂直倾斜角度,默认值为0。以角度为单位。 64 | bird.skewY = 180; 65 | //镜像翻转 66 | bird.scaleX = -1; 67 | } 68 | return bird; 69 | } 70 | //放置位置应该是在地板处放置 71 | })(); -------------------------------------------------------------------------------- /src/runGame/Player.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | /** 3 | * 玩家类 4 | */ 5 | function Player(decelerationEnergy, invincibleEnergy) { 6 | 7 | //减速能量条的引用 8 | this.decelerationEnergy = decelerationEnergy; 9 | //无敌能量条的引用 10 | this.invincibleEnergy = invincibleEnergy; 11 | //当前动作 12 | this.action = null; 13 | //玩家 14 | this.body = null; 15 | //玩家状态 "up" ? "down" 16 | this.status = "up"; 17 | //玩家跑动状态 "normal" ? "deceleration" ? "invincible" 18 | //是否已经踩在地板上了 19 | this.isOnFloor = false; 20 | //是否在特效中 21 | this.isInEffect = false; 22 | //是否在减速状态下 23 | this.isInLowerSpeed = false; 24 | 25 | //下落变量 26 | this.vy = PLAYER_DOWN_VY; 27 | //下落速度 28 | this.downSpeed = PLAYER_DOWN_SPEED; 29 | //最大下落值 30 | this.maxVy = PLAYER_DOWN_MAX_SPEED; 31 | //是否停止下落 32 | this.isStopDown = false; 33 | 34 | //这里我们强制设置玩家的宽度和高度 35 | this.width = 96; 36 | this.height = 96; 37 | 38 | this.sp = null; 39 | 40 | Player.__super.call(this); 41 | //初始化 42 | this.init(); 43 | } 44 | 45 | 46 | //跑动 47 | Player.RUN = "player_run"; 48 | //飞行 49 | Player.FLY = "player_fly"; 50 | //状态 51 | Player.DIE = "player_die"; 52 | 53 | //注册 54 | Laya.class(Player, "Player", Sprite); 55 | 56 | //图集是否缓存,避免一次请求一次加载的状况 57 | Player.cached = false; 58 | 59 | //获取原型 60 | var _proto = Player.prototype; 61 | 62 | _proto.init = function () { 63 | //缓存动画 64 | if (!Player.cached) { 65 | 66 | //跑动的动画 67 | Animation.createFrames(['res/player/chara_01.png', 'res/player/chara_02.png', 'res/player/chara_03.png', 'res/player/chara_04.png'], Player.RUN); 68 | //飞行的动画 69 | Animation.createFrames(['res/player/chara_05.png', 'res/player/chara_06.png', 'res/player/chara_07.png', 'res/player/chara_08.png'], Player.FLY); 70 | //图像缓存完毕 71 | Player.cached = true; 72 | } 73 | 74 | if (this.body == null) { 75 | this.body = new Animation(); 76 | this.body.interval = PLAYER_RUN_SPEED; 77 | this.addChild(this.body); 78 | } 79 | 80 | //播放相应的动画 81 | this.playAction(Player.RUN); 82 | 83 | //创建帧循环处理函数 84 | Laya.timer.frameLoop(PLAYER_FRAME_DELAY, this, this.onLoop); 85 | } 86 | 87 | _proto.playAction = function (action) { 88 | //如果是重复动作,则不执行 89 | if (this.action == action) {return;}; 90 | 91 | this.action = action; 92 | //播放相应的动画 93 | this.body.play(0, true, this.action); 94 | } 95 | 96 | _proto.onLoop = function () { 97 | this.body.x = BG_WIDTH / 10; 98 | if (!this.isStopDown) {//在最开始玩家开始下落 99 | this.y += this.vy; 100 | this.vy += this.downSpeed; 101 | //控制下落最大值 102 | if (this.vy >= this.maxVy) { this.vy = this.maxVy }; 103 | //如果掉落到屏幕外 104 | if (this.y > BG_HEIGHT) { return; } 105 | } else if (this.isStopDown) { 106 | 107 | } else { 108 | 109 | } 110 | //判断玩家是否在特效中 111 | if(this.isInEffect){ 112 | //如果在特效中,慢慢的消耗能量,直到能量为0,就回到默认状态 113 | this.invincibleEnergy.addEnergyValue(-ITEM_INVINCIBLE_DESCENT_SPEED); 114 | if(this.invincibleEnergy.value <= 0){ 115 | this.hideEffect(); 116 | } 117 | } 118 | //判断是否在减速中 119 | if(this.isInLowerSpeed){ 120 | //如果在减速中,慢慢的消耗能量,直到能量为0,就回到默认状态 121 | this.decelerationEnergy.addEnergyValue(-ITEM_DECELERATION_DESCENT_SPEED); 122 | if(this.decelerationEnergy.value <= 0){ 123 | this.decelerationEnergy.updateEnergyValue(0); 124 | } 125 | } 126 | } 127 | 128 | _proto.hitCheck = function(playerX,playerY,itemX,itemY,itemDirectionStatus,itemTpye,playerStatus){ 129 | //console.log("px=" + playerX + " py=" + playerY + " ix=" + itemX + " iy=" + itemY + " xxx=" +- (((BG_HEIGHT - FLOOR_HEIGHT) / 2) - playerY)); 130 | var itemWidth = 0; 131 | var itemHeight = 0; 132 | //根据传过来的道具类型来确定物品的大小 133 | switch(itemTpye){ 134 | case Npc.NPC_TYPE_BIRD: 135 | itemWidth = NPC_BIRD_WIDTH; 136 | itemHeight = NPC_BIRD_HEIGHT; 137 | break; 138 | case Item.ITEM_TYPE_STAR: 139 | itemWidth = ITEM_STAR_WIDTH; 140 | itemHeight = ITEM_STAR_HEIGHT; 141 | break; 142 | case Item.ITEM_TYPE_DECELERATION: 143 | itemWidth = ITEM_DECELERATION_WIDTH; 144 | itemHeight = ITEM_DECELERATION_HEIGHT; 145 | break; 146 | case Item.ITEM_TYPE_INVINCIBLE: 147 | itemWidth = ITEM_INVINCIBLE_WIDTH; 148 | itemHeight = ITEM_INVINCIBLE_HEIGHT; 149 | break; 150 | } 151 | //判断碰撞要考虑前方后方和玩家转换方向后正好撞在道具上面 152 | if(playerStatus == "up"){ 153 | if(((playerX - Math.abs(itemX) - itemWidth/2 ) >= 0 ) && (itemDirectionStatus == "up") && (playerX < itemX + itemWidth + PLAYER_WIDTH/2)){ 154 | return true; 155 | }else{return false} 156 | }else if(playerStatus == "down"){ 157 | if((((playerX - Math.abs(itemX) - itemWidth/2 ) >= 0 ) && (itemDirectionStatus == "down") && (playerX < itemX + itemWidth + PLAYER_WIDTH/2))){ 158 | return true; 159 | }else{return false} 160 | } 161 | } 162 | 163 | //开始跑 164 | _proto.gotoRun = function () { 165 | this.playAction(Player.RUN); 166 | } 167 | //开始飞 168 | _proto.gotoFly = function () { 169 | this.playAction(Player.FLY); 170 | }; 171 | //翻转人物 172 | _proto.flip = function () { 173 | //如果玩家在上面,那么将玩家翻转到下面 174 | if (this.status == "up") { 175 | //设置玩家的当前状态 176 | this.status = "down"; 177 | //水平倾斜角度,默认值为0。以角度为单位 178 | this.body.skewX = 180; 179 | //垂直倾斜角度,默认值为0。以角度为单位。 180 | this.body.skewY = 180; 181 | //镜像翻转 182 | this.body.scaleX = -1; 183 | //设置Y轴的位置 184 | // this.body.y = (BG_HEIGHT/2) ; 185 | }else if(this.status == "down"){ 186 | //设置玩家的当前状态 187 | this.status = "up"; 188 | //水平倾斜角度,默认值为0。以角度为单位 189 | this.body.skewX = 0; 190 | //垂直倾斜角度,默认值为0。以角度为单位。 191 | this.body.skewY = 0; 192 | //镜像翻转 193 | this.body.scaleX = 1; 194 | //设置Y轴的位置 195 | // this.body.y -= (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30; 196 | } 197 | } 198 | 199 | //是否处于特效中 200 | _proto.isInEffect = false; 201 | 202 | //显示特效 203 | _proto.showEffect = function(){ 204 | if(!(this.invincibleEnergy.value >= 80 && this.isInEffect)){IS_PAUSE = true;/*暂停游戏*/ } 205 | this.isInEffect = true; 206 | this.gotoFly(); 207 | FLOOR_SPEED = 10; 208 | Laya.loader.load("res/particle/particle.part", Handler.create(this, this.Showparticle), null, Laya.Loader.JSON); 209 | } 210 | _proto.Showparticle = function(settings){ 211 | //播放无敌状态音乐 212 | SoundManager.playSound("res/wav/Invincible_start.wav",1); 213 | this.sp = new Laya.Particle2D(settings); 214 | // console.log(this.sp); 215 | this.sp.x = this.body.x*1.5; 216 | this.sp.y -= 20; 217 | this.addChild(this.sp); 218 | this.sp.emitter.start(); 219 | this.sp.emitter._emissionRate = 20; 220 | this.sp.play(); 221 | IS_PAUSE = false; 222 | } 223 | 224 | //特效停止 225 | _proto.hideEffect = function(){ 226 | //播放特效停止音效 227 | SoundManager.playSound("res/wav/Invincible_end.wav"); 228 | // this.sp.destroy(); 229 | this.sp.stop(); 230 | // this.sp.emitter.clear(); 231 | IS_FLOOR_SPEED_MAX = false; 232 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 233 | this.isInEffect = false; 234 | this.gotoRun(); 235 | } 236 | 237 | })(); -------------------------------------------------------------------------------- /src/runGame/RunGame.js: -------------------------------------------------------------------------------- 1 | //游戏主文件,入口文件 2 | (function () { 3 | /** 4 | * 游戏入口 5 | */ 6 | function RunGame() { 7 | 8 | this.bg = null; 9 | this.mapFloor = null; 10 | this.player = null; 11 | 12 | this.hpEnergy = null; 13 | this.speedEnergy = null; 14 | 15 | this.score = 0; 16 | 17 | this.isFirstPlayGame = true; 18 | 19 | RunGame.__super.call(this); 20 | 21 | this.init(); 22 | } 23 | 24 | //RunGame 是一个显示对象 继承此 Sprite 注册这个RunGame类 25 | Laya.class(RunGame, "RunGame", Sprite); 26 | 27 | //定义RumGame的原型 28 | var _proto = RunGame.prototype; 29 | 30 | //初始化 31 | _proto.init = function () { 32 | //添加背景 33 | this.bg = new BackGround(); 34 | this.addChild(this.bg); 35 | 36 | //添加地板 37 | this.mapFloor = new MapFloor(); 38 | this.addChild(this.mapFloor); 39 | 40 | //无敌能量条 41 | this.Invincible = new EnergyBar(EnergyBar.TYPE_INVINCIBLE); 42 | this.Invincible.y = 7; 43 | this.addChild(this.Invincible); 44 | 45 | //减速能量条 46 | this.Deceleration = new EnergyBar(EnergyBar.TYPE_DECELERATION); 47 | this.Deceleration.y = 7; 48 | this.Deceleration.x = this.Invincible.width + 10; 49 | this.addChild(this.Deceleration); 50 | 51 | //分数 52 | this.scoreText = new Text(); 53 | this.scoreText.color = SCORETEXT_COLOR; 54 | this.scoreText.fontSize = SCORETEXT_FONT_SIZE; 55 | this.scoreText.text = SCORETEXT_TEXT_DEFAULT; 56 | this.scoreText.width = BG_WIDTH; 57 | this.scoreText.align = SCORETEXT_ALIGN; 58 | this.scoreText.x = -10; 59 | this.scoreText.y = 10; 60 | this.addChild(this.scoreText); 61 | 62 | //添加主角 63 | this.player = new Player(this.Invincible,this.Deceleration); 64 | this.addChild(this.player); 65 | 66 | //监听鼠标按下弹起事件 67 | Laya.stage.on(laya.events.Event.MOUSE_DOWN, this, this.onMouseDown) 68 | 69 | //创建帧循环处理函数 70 | Laya.timer.frameLoop(1, this, this.onLoop); 71 | } 72 | 73 | _proto.onLoop = function () { 74 | //获取所有的地板 75 | for (var i = this.mapFloor.numChildren - 1; i > - 1; i--) { 76 | var floor = this.mapFloor.getChildAt(i); 77 | //判断玩家是否踩在了地板上,已经踩在地板上就可以终止判断了 78 | if (!this.player.isOnFloor) { 79 | //检测主角是否踩在地板上 80 | if (floor.checkHit(this.player.x, this.player.y, this.player.status)) { 81 | //人物如果踩到地板了 就把人物的坐标设置到地板上面 82 | if (this.player.status == "up") { 83 | this.player.isStopDown = true;//停止下落 84 | this.player.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30; 85 | // this.player.y -= 128; 86 | this.bg.cat.pos(BG_WIDTH * 1.2, this.player.y - 30); 87 | this.player.isOnFloor = true; 88 | } else if (this.player.status == "down") { } 89 | } 90 | } 91 | //检测是否碰到道具了 92 | var itemList = floor.getAllItems(); 93 | var npcList = floor.getAllNpcs(); 94 | for(var j = 0;j < itemList.length;j++){ 95 | var item = itemList[j]; 96 | //只有显示的物品才做碰撞检测 97 | if(item.visible ){ 98 | //拿到物品的位置信息 99 | if(this.player.hitCheck(this.player.body.x,this.player.y,item.x + floor.x - PLAYER_WIDTH,item.y,item.directionStatus,item.type,this.player.status)){ 100 | //物品有多个类型 分类型进行判断 101 | if(item.type == Item.ITEM_TYPE_DECELERATION){ 102 | //播放减速道具音乐 103 | SoundManager.playSound("res/wav/DecelerationCounting.wav",1); 104 | item.visible = false; 105 | this.player.decelerationEnergy.addEnergyValue(20); 106 | if(this.player.decelerationEnergy.value >= 100){ 107 | if(!this.player.isInEffect){ 108 | //减速 109 | this.player.decelerationEnergy.updateEnergyValue(100); 110 | this.player.isInLowerSpeed = true; 111 | //播放减速效果音效 112 | SoundManager.playSound("res/wav/LowerSpeed.wav",1); 113 | floor.moveLower(this); 114 | } 115 | } 116 | }else if(item.type == Item.ITEM_TYPE_INCINCIBLE){ 117 | //播放无敌药水的声音 118 | SoundManager.playSound("res/wav/InvincibleCounting.wav",1); 119 | item.visible = false; 120 | this.player.invincibleEnergy.addEnergyValue(20); 121 | if(this.player.invincibleEnergy.value == 100 && !this.player.isInEffect){ 122 | //无敌 123 | 124 | this.player.showEffect();} 125 | 126 | }else{ 127 | this.scoreAdd(1); 128 | //播放星星的相关音乐 129 | SoundManager.playSound("res/wav/StarCounting.wav",1); 130 | item.visible = false; 131 | //星星物品播放动画 132 | // item.TweenStar(item); 133 | } 134 | 135 | } 136 | } 137 | } 138 | //npc碰撞检测 139 | for(var k = 0;k < npcList.length;k++){ 140 | var npc = npcList[k]; 141 | //只有显示的npc才做碰撞检测 142 | if(npc.visible){ 143 | //拿到npc的位置信息 144 | if(this.player.hitCheck(this.player.body.x,this.player.y,npc.x + floor.x - PLAYER_WIDTH,npc.y,npc.directionStatus,npc.type,this.player.status)){ 145 | //npc类型判断 146 | switch(npc.type){ 147 | case Npc.NPC_TYPE_BIRD: 148 | if(this.player.isInEffect){break;} 149 | //停止游戏 150 | this.stopAllGame(); 151 | var isRestartGame = true; 152 | initGame(isRestartGame);//位于init.js 153 | } 154 | } 155 | } 156 | 157 | } 158 | } 159 | 160 | } 161 | //分数栏更新 162 | _proto.scoreAdd = function(value){ 163 | this.scoreText.text = parseInt(this.scoreText.text) + value; 164 | // console.log(this.scoreText.text + " " + typeof(this.scoreText.text)); 165 | } 166 | //鼠标按下事件 167 | _proto.onMouseDown = function () { 168 | if(this.isFirstPlayGame){ 169 | //移除gameInfo 170 | Laya.stage.removeChild(gameInfo); 171 | //移除之后游戏开始 172 | IS_PAUSE = false; 173 | isFirstPlayGame = false; 174 | } 175 | //在下落过程中不允许翻转 176 | if (!this.player.isOnFloor) { return; } 177 | 178 | this.player.flip(); 179 | //不知道为何,在Player里面设置XY一直不成功,所以改在这里设置 180 | // console.log("玩家状态:" + this.player.status + " 玩家Y轴位置:" + this.player.y); 181 | if (this.player.status == "up") { this.player.y = (BG_HEIGHT - FLOOR_HEIGHT) / 2 - PLAYER_HEIGHT + 30 } 182 | else if (this.player.status == "down") { this.player.y = ((BG_HEIGHT + FLOOR_HEIGHT) / 2) + PLAYER_HEIGHT - 15 } 183 | } 184 | //停止游戏 185 | _proto.stopAllGame = function(){ 186 | //停止渲染游戏 187 | Laya.stage.renderingEnabled=false; 188 | //清除减速条数据 189 | this.player.decelerationEnergy.updateEnergyValue(0); 190 | //清除无敌条数据 191 | this.player.invincibleEnergy.updateEnergyValue(0); 192 | //清除分数数据 193 | this.scoreText.text = SCORETEXT_TEXT_DEFAULT; 194 | //清除奔跑速度数据 195 | FLOOR_SPEED = FLOOR_SPEED_DEFAULT; 196 | //停止播放所有声音 197 | SoundManager.stopAll(); 198 | //设置人物状态 199 | this.player.status = "down"; 200 | //停止循环 201 | Laya.timer.clear(this,this.onLoop); 202 | } 203 | })(); -------------------------------------------------------------------------------- /洛洛地平线-功能函数文档.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/洛洛地平线-功能函数文档.xls -------------------------------------------------------------------------------- /落落地平线.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/510850111/Lolo-Horizon/0d00ef32e8555d0705d5ef2cb78685636a8c6be5/落落地平线.pptx --------------------------------------------------------------------------------