微信小游戏实战 | 您所在的位置:网站首页 › 微信小游戏星球大战 › 微信小游戏实战 |
1. 目录结构: 2. game.js:入口文件 //game.js文件完整代码: import Main from "./src/mian.js" new Main()![]() 3. game.json:全家配置参数文件,参考https://developers.weixin.qq.com/minigame/dev/reference/configuration/app.html。 { "deviceOrientation":"portrait", " showStatusBar":true }4. src/main.js:初始化js逻辑代码文件: import Background from "./all/background.js" import Audio from "./all/audio.js" import Hero from "./all/hero.js" import Bullet from "./all/bullet.js" import Enemy from "./all/enemy.js" import Animation from "./all/animation.js" import Text from "./all/text.js" class main{ constructor(){ this.canvas = wx.createCanvas() this.ctx = this.canvas.getContext('2d') this.ch=GameGlobal.innerHeight //屏幕的高 this.cw = GameGlobal.innerWidth //屏幕的宽 this.bulletObjArr=[] //存放屏幕内可见的子弹数组 this.enemyObjArr=[] //存放屏幕内可见的敌机数组 this.animationObjArr=[] //存放屏幕内可见的爆炸效果动画的数组 this.bangImgArr=[] //提前缓存19张爆炸效果图数组 for(let i=0;i |
CopyRight 2018-2019 实验室设备网 版权所有 |