mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 11:43:16 +02:00
easier bouncing
This commit is contained in:
parent
1ec70e8170
commit
789f3231e1
1 changed files with 14 additions and 18 deletions
|
@ -29,7 +29,6 @@ var grid = [
|
|||
];
|
||||
|
||||
|
||||
|
||||
easystar.setGrid(grid);
|
||||
|
||||
easystar.setAcceptableTiles([0]);
|
||||
|
@ -40,6 +39,7 @@ easystar.findPath(0, 0, 8, 0, function(path) {
|
|||
Script.update.disconnect(tickEasyStar);
|
||||
} else {
|
||||
print('path' + JSON.stringify(path));
|
||||
|
||||
convertPath(path);
|
||||
Script.update.disconnect(tickEasyStar);
|
||||
}
|
||||
|
@ -79,6 +79,16 @@ var playerSphere = Entities.addEntity({
|
|||
linearDamping: 0.2
|
||||
});
|
||||
|
||||
Script.setInterval(function(){
|
||||
Entities.editEntity(playerSphere,{
|
||||
velocity:{
|
||||
x:0,
|
||||
y:4,
|
||||
z:0
|
||||
}
|
||||
})
|
||||
},1000)
|
||||
|
||||
var sphereProperties;
|
||||
|
||||
//for keeping track of entities
|
||||
|
@ -187,12 +197,8 @@ function updatePosition() {
|
|||
x: currentSpherePosition.z,
|
||||
y: sphereProperties.position.y,
|
||||
z: currentSpherePosition.x
|
||||
},
|
||||
velocity: {
|
||||
x: 0,
|
||||
y: velocityShaper.y,
|
||||
z: 0
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -227,19 +233,9 @@ function createTweenPath(convertedPath) {
|
|||
stepTweens[j].chain(stepTweens[j + 1]);
|
||||
}
|
||||
|
||||
|
||||
var velocityUpTween = new TWEEN.Tween(velocityShaper).to(upVelocity, ANIMATION_DURATION).onUpdate(updatePosition);
|
||||
var velocityDownTween = new TWEEN.Tween(velocityShaper).to(noVelocity, ANIMATION_DURATION).onUpdate(updatePosition);
|
||||
|
||||
velocityUpTween.chain(velocityDownTween);
|
||||
velocityDownTween.chain(velocityUpTween);
|
||||
|
||||
|
||||
velocityUpTween.easing(TWEEN.Easing.Linear.None)
|
||||
velocityDownTween.easing(TWEEN.Easing.Back.InOut)
|
||||
//start the tween
|
||||
//start the tween
|
||||
stepTweens[0].start();
|
||||
velocityUpTween.start();
|
||||
|
||||
}
|
||||
|
||||
var velocityShaper = {
|
||||
|
|
Loading…
Reference in a new issue