Commit c7e435f0 authored by wildfirecode13's avatar wildfirecode13

1

parent f9df87f4
...@@ -50,7 +50,7 @@ class GameStage extends WidgetBase { ...@@ -50,7 +50,7 @@ class GameStage extends WidgetBase {
const ball = new Body({ const ball = new Body({
display: 'box', display: 'box',
initialVelocityY: 0, initialVelocityY: 0,
initialVelocityX: 1, initialVelocityX: 2,
accelerationY: 2, accelerationY: 2,
restitution: 0 restitution: 0
}); });
...@@ -73,18 +73,9 @@ class GameStage extends WidgetBase { ...@@ -73,18 +73,9 @@ class GameStage extends WidgetBase {
const dis0 = body.width / 2 + ground.data.width / 2; const dis0 = body.width / 2 + ground.data.width / 2;
const dis1 = Math.abs(body.x + body.width / 2 - ground.data.x - ground.data.width / 2); const dis1 = Math.abs(body.x + body.width / 2 - ground.data.x - ground.data.width / 2);
if (y0 > ground.y && dis1 < dis0) { if (y0 > ground.y && dis1 < dis0) {
// if (!body.checkCollideGround) {
// body.checkCollideGround = ground;
// console.log('碰撞了地面', JSON.stringify(ground.data));
// }
body.y = ground.y - body.height; body.y = ground.y - body.height;
body.velocityY = -body.velocityY * body.restitution; body.velocityY = -body.velocityY * body.restitution;
break; break;
} else {
// if (body.checkCollideGround) {
// console.log('取消碰撞地面', JSON.stringify(ground.data));
// }
// body.checkCollideGround = null;
} }
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
}, },
{ {
"name": "box", "name": "box",
"url": "//yun.duiba.com.cn/aurora/assets/2ded44a3459c08e000d08b60dd6248d283fe2c80.png", "url": "//yun.duiba.com.cn/aurora/assets/45acae15337682c4a2c1c694a3b0a54509cc0b14.png",
"uuid": "box", "uuid": "box",
"ext": ".png" "ext": ".png"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment