💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](https://box.kancloud.cn/140a6f3ed9750e7e19987ec1077c68c5_942x475.png) 舞台是固定大小的,所展示出的一面,世界是大小可设置的,甚至无限大的。 ![](https://box.kancloud.cn/51f2225900c3b9686b7a74268d85f39c_936x325.png) ![](https://box.kancloud.cn/de0b2c5695a26eb3d94c5fb0dd9406d4_428x228.png) ![](https://box.kancloud.cn/6b696ce0fd182428b797e502ec24ef7d_362x541.png) ![](https://box.kancloud.cn/986601506ee62e1b2ac4ce6521d2fb47_983x373.png) ![](https://box.kancloud.cn/eea4f8fa32059a0c82b2274878031599_922x427.png) 摄像机大小默认是世界大小,如果设置世界大小很大 摄像机就可以移动啦, 例子: ~~~ var play = function(game){ this.init=function(){} this.preload = function(){ var fj = game.add.image(0,0,'fj') fj.anchor = {x:0.5,y:0.5} //设置图片锚点 } this.create = function(){ console.log('play') game.world.setBounds(0,0,2000,600)//设置是世界大小 参数 左上角xy坐标,宽高 } this.update = function(){ var keys = game.input.keyboard.createCursorKeys() if(keys.right.isDown){game.camera.x += 1} else if(keys.left.isDown){game.camera.x -= 1} else if(keys.down.isDown){game.camera.y += 1} else if(keys.up.isDown){game.camera.y -= 1} } this.render = function(){} } ~~~ 相机即可跟着键盘移动而移动啦 相机聚焦到某个物体 ~~~ var play = function(game){ this.init=function(){} this.preload = function(){ var fj = game.add.image(0,0,'fj') } this.create = function(){ console.log('play') game.world.setBounds(0,0,2000,600)//设置是世界大小 参数 左上角xy坐标,宽高 pig = game.add.image(200,300,'pig') pig.anchor.set(0.5,0.5) game.camera.focusOn(pig) //相机聚焦到小猪上 } this.update = function(){ var keys = game.input.keyboard.createCursorKeys() if(keys.right.isDown){game.camera.x += 1} else if(keys.left.isDown){game.camera.x -= 1} else if(keys.down.isDown){game.camera.y += 1} else if(keys.up.isDown){game.camera.y -= 1} } this.render = function(){} } ~~~ ![](https://box.kancloud.cn/2c8a2b249c37735fdbda8436a464f6ad_332x512.png) 让相机跟随小猪移动` ~~~ game.camera.follow(pig) ~~~`