hi every body
I make math3 game and I found new bug with collision the bug you can see bug on video
and my code on teleport part is :
onCollisionEnter(other:cc.Collider , self){
if (this.node.name == "origin" ) {
// send cube
this.sendCube(other.node)
}
}
private sendCube(other : cc.Node){
let desNodeComp = this.desNode.getComponent(Teleport)
let startPosition = this.desNode.getPosition()
let otherComp = other.getComponent(cubeController);
var pos = new cc.Vec2( other.position.x, (this.startNodeComp.YCountCube / 2 ) * this.startNodeComp.cubeSize )
pos.y -= (this.startNodeComp.cubeSize * otherComp.j) + (10 / 2)
if (otherComp.canteleport) {
otherComp.canteleport = false
otherComp.setCubePositionOnBoard(pos)
other.setPosition(startPosition)
if (this.differentPlace) {
pos.y += this.startNodeComp.cubeSize
}
}
pos = new cc.Vec2((startGame._instance.xCountCube / 2 ) * startGame._instance.cubeSize, (startGame._instance.YCountCube / 2 ) * startGame._instance.cubeSize )
pos.y -= (startGame._instance.cubeSize * otherComp.j) + 60
pos.x -= startGame._instance.cubeSize * otherComp.i + startGame._instance.startPos.x
other.stopAllActions()
other.runAction(cc.sequence([
cc.moveTo(1,pos ).easing(cc.easeElasticOut(1)),
cc.callFunc(() => {
gameManager._instance.nodesInActions = 0
})
]))
}