Commit 04751d49 authored by zjz1994's avatar zjz1994

弹球

parent e8942e4f
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1144,6 +1144,9 @@
return noraml;
}
}
ball.view.x += ball.velocity.x;
ball.view.y += ball.velocity.y;
return false;
}
else {
return false;
......@@ -1335,7 +1338,6 @@
txt.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
sprite["txt"] = txt;
sprite.addChild(txt);
console.log("特殊建筑三角形", length);
block = new RegTriangle(length, sprite);
block.type = key;
that.addChild(block.view);
......@@ -1893,7 +1895,6 @@
if (specialBallPosition > -1) {
createSpeialCircle(this, getLadderHPosition(specialBallPosition), getLadderPosition(LADDER_NUMS - 1), 0);
}
console.log("创建障碍物", blocksInfo, specialBallPosition);
for (var _i = 0, blocksInfo_1 = blocksInfo; _i < blocksInfo_1.length; _i++) {
var block = blocksInfo_1[_i];
var position = block.position, type = block.type, nums = block.nums;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -238,7 +238,6 @@ export default class PlayScene extends engine.Container {
createSpeialCircle(this, getLadderHPosition(specialBallPosition), getLadderPosition(LADDER_NUMS - 1), 0);
}
console.log("创建障碍物",blocksInfo,specialBallPosition);
for (const block of blocksInfo) {
const { position, type, nums } = block;
......
......@@ -34,11 +34,11 @@ export default (that: PlayScene, x, y, length, rotation, key = 'specialRegTriang
sprite["txt"] = txt;
sprite.addChild(txt);
console.log("特殊建筑三角形",length);
block = new RegTriangle(length, sprite);
block.type = key;
that.addChild(block.view)
that.addChild(block.view);
//误差处理
block.x = x-BALL_D/2;
block.y = y-BALL_D/2;
block.rotation = rotation;
......
......@@ -204,6 +204,8 @@ export class RegPolygon extends Body {
v2 = new Vector(closestPoint.x, closestPoint.y);
axes.push(v1.subtract(v2).normalize());
// console.log("多边形的碰撞",!this.separationOnAxes(axes, ball));
return !this.separationOnAxes(axes, ball);
}
......@@ -269,6 +271,8 @@ export class RegPolygon extends Body {
var speedX = velocity.x / (deta + 1);
var speedY = velocity.y / (deta + 1);
// console.log("多边形碰撞-----1",deta);
// console.log(this.nearestCollideNormal({ x: returnP.x - velocity.x, y: returnP.y - velocity.y }, ball,deta+1,i+1))
for (var i = 0; i <= deta; i++) {
this.ballPosition(ball, deta + 1, i + 1)
......@@ -283,10 +287,15 @@ export class RegPolygon extends Body {
// ball.view.y += ball.velocity.y / (deta + 1) * (i + 1);
// return false
// }else{
// console.log("多边形碰撞返回",noraml);
return noraml
// }
}
}
ball.view.x += ball.velocity.x;
ball.view.y += ball.velocity.y;
// console.log("多边形碰撞-----2");
return false;
} else {
return false
}
......
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