修改了部分推币机 5%

This commit is contained in:
rucky 2022-02-18 18:39:40 +08:00
parent 23d8425962
commit c86df30c9c
2 changed files with 64 additions and 60 deletions

View File

@ -55,9 +55,9 @@ class game {
init(pointer) { init(pointer) {
this.vue = pointer; this.vue = pointer;
// 初始化画布 // 初始化画布
// this.stage = new STAGE().createStage(this); this.stage = new STAGE().createStage(this);
//实例化layout //实例化layout
// this.VIEW = new LAYOUT(this); this.VIEW = new LAYOUT(this);
// 保存帧率 // 保存帧率
// this.saveMomentFPS = setInterval(() => { // this.saveMomentFPS = setInterval(() => {
@ -74,65 +74,10 @@ class game {
// 初始化主资源加载器 // 初始化主资源加载器
// this.loadingRes(); this.loadingRes();
// create an engine
this.myEngine = this.Engine.create();
this.myWorld = this.myEngine.world;
// create a renderer
this.myRender = this.Render.create({
element: this.vue.$refs.container,
engine: this.myEngine,
options: {
width: window.innerWidth,
height: window.innerHeight,
pixelRatio: 1, // 设置像素比
showAngleIndicator: true,
wireframes: true,
showDebug: false
}
});
// create two boxes and a ground
var boxA = this.Bodies.rectangle(100, 200, 80, 80);
var boxB = this.Bodies.rectangle(150, 50, 80, 80);
var boxC = this.Bodies.rectangle(150, 50, 80, 80);
var boxD = this.Bodies.rectangle(150, 50, 80, 80);
var ground = this.Bodies.rectangle(0, 800, 750, 10, { isStatic: true });
// this.Composite.add(this.myWorld, [
// this.Bodies.fromVertices(
// 0, 0,
// [
// // 顶点坐标
// { x: 0, y: 0 },
// { x: 0, y: 890 },
// { x: 140, y: 815 },
// { x: 208, y: 614 },
// { x: 548, y: 614 },
// { x: 612, y: 815 },
// { x: 750, y: 890 },
// { x: 750, y: 0 }
// ],
// { isStatic: true }
// )
// ]);
// add all of the bodies to the world
this.Composite.add(this.myWorld, [boxA, boxB, boxC, boxD, ground]);
// create runner
this.Render.run(this.myRender);
// run the engine
this.myRunner = this.Runner.create();
this.Runner.run(this.myRunner, this.myEngine);
// 初始化物理引擎
this.initMatterEngine();
} }
@ -238,6 +183,63 @@ class game {
console.log(this.globalSpeed) console.log(this.globalSpeed)
} }
//
initMatterEngine() {
// create an engine
this.myEngine = this.Engine.create();
this.myWorld = this.myEngine.world;
// create a renderer
// this.myRender = this.Render.create({
// element: this.vue.$refs.container,
// engine: this.myEngine,
// options: {
// width: window.innerWidth,
// height: window.innerHeight,
// pixelRatio: 1, // 设置像素比
// showAngleIndicator: true,
// wireframes: true,
// showDebug: true
// }
// });
// create two boxes and a ground
var boxA = this.Bodies.rectangle(100, 200, 80, 80);
var boxB = this.Bodies.rectangle(150, 50, 80, 80);
var boxC = this.Bodies.rectangle(150, 50, 80, 80);
var boxD = this.Bodies.rectangle(150, 50, 80, 80);
var ground = this.Bodies.rectangle(0, 800, 750, 10, { isStatic: true });
// this.Composite.add(this.myWorld, [
// this.Bodies.fromVertices(
// 0, 0,
// [
// // 顶点坐标
// { x: 0, y: 0 },
// { x: 0, y: 890 },
// { x: 140, y: 815 },
// { x: 208, y: 614 },
// { x: 548, y: 614 },
// { x: 612, y: 815 },
// { x: 750, y: 890 },
// { x: 750, y: 0 }
// ],
// { isStatic: true }
// )
// ]);
// add all of the bodies to the world
this.Composite.add(this.myWorld, [boxA, boxB, boxC, boxD, ground]);
// create runner
// this.Render.run(this.myRender);
// run the engine
// this.myRunner = this.Runner.create();
// this.Runner.run(this.myRunner, this.myEngine);
this.Engine.run(this.myEngine);
}
//debug mode destroyed //debug mode destroyed
//game model //game model

View File

@ -95,6 +95,8 @@ class layout {
// 创建粒子动画 // 创建粒子动画
this.createLoadingParticle(); this.createLoadingParticle();
console.log(this.loading_bg)
return this return this
} }