在一个矩行星上,走到行星的拐角点,会滑到另一个方向。走起来挺好玩儿!
使用的图片:
函数:
function preload(){
}
function create(){
}
function update(){
}
function moveCounterClockwise(){
}
function moveClockwise(){
}
function stopMoving(){
}
function checkRotation(){
}
function handleRotation(delta, targetX, targetY){
this.hero.body.setAllowGravity(false);
this.hero.setVelocity(0, 0)
this.rotating = true;
this.tweens.add({
targets: [this.hero],
angle: this.hero.angle + 90 * delta,
x: targetX,
y: targetY,
duration: 200,
callbackScope: this,
onComplete: function(){
this.rotating = false;
this.hero.body.setAllowGravity(true);
this.direction = Phaser.Math.Wrap(this.direction + delta, 0, 4);
this.setGravity();
}
});
}
function setGravity(){
}
function jump(){
}
function getHeight(){
}