Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyRobot.prototype.update=function(currTime){
- if (this.lastUpdate == -1)
- this.lastUpdate = currTime;
- var diff = currTime - this.lastUpdate;
- if (this.handMove != 0)
- {
- if (this.tempXRot == 999 && this.tempZRot == 999)
- {
- this.tempXRot = -this.armRotation;
- this.tempZRot = 0;
- }
- else if (this.tempXRot <= -165 && this.movementPart != 4)
- {
- if (this.tempZRot > -20 && this.movementPart == 0)
- this.tempZRot -= diff * (360 / (60 * 100));
- else if (this.tempZRot < 0 && this.movementPart == 1)
- {
- this.movementPart = 1;
- this.tempZRot += diff * (360 / (60 * 100));
- }
- else if (this.tempZRot < 0 && this.movementPart == 0)
- this.movementPart = 1;
- else
- {
- this.handMove++;
- this.movementPart = 0;
- if (this.handMove == 4)
- this.movementPart = 4;
- }
- }
- else if (this.movementPart != 4)
- this.tempXRot -= diff * (360 / (60 * 50));
- else
- {
- if (-this.armRotation + 10 > this.tempXRot && -this.armRotation - 10 < this.tempXRot)
- {
- this.handMove = 0;
- this.tempXRot = 999;
- this.tempZRot = 999;
- this.movementPart = 0;
- }
- else
- this.tempXRot += diff * (360 / (60 * 50));
- }
- }
- this.lastUpdate = currTime;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement