moved overflow checks into top of the functions
This commit is contained in:
parent
db44f47368
commit
dc2ac1d5e0
@ -33,10 +33,6 @@ function load_panorama()
|
|||||||
|
|
||||||
function turn_left()
|
function turn_left()
|
||||||
{
|
{
|
||||||
//MOVE AN 8th TO LEFT
|
|
||||||
x1 -= WIDTH * MOVE_PIECES;
|
|
||||||
x2 -= WIDTH * MOVE_PIECES;
|
|
||||||
|
|
||||||
if (turn < 0 && (Math.abs(turn) - (1/MOVE_PIECES / 2)) >= 0)
|
if (turn < 0 && (Math.abs(turn) - (1/MOVE_PIECES / 2)) >= 0)
|
||||||
{
|
{
|
||||||
//ctx.drawImage(img, img.width - WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), 0, img.width, img.height, 0, 0, WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), WIDTH * ASPECT_RATIO); //DRAW RIGHT PART ON THE LEFT SIDE //TODO
|
//ctx.drawImage(img, img.width - WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), 0, img.width, img.height, 0, 0, WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), WIDTH * ASPECT_RATIO); //DRAW RIGHT PART ON THE LEFT SIDE //TODO
|
||||||
@ -44,6 +40,10 @@ function turn_left()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MOVE AN 8th TO LEFT
|
||||||
|
x1 -= WIDTH * MOVE_PIECES;
|
||||||
|
x2 -= WIDTH * MOVE_PIECES;
|
||||||
|
|
||||||
ctx.drawImage(img, x1, 0, img.width - WIDTH * MOVE_PIECES, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW
|
ctx.drawImage(img, x1, 0, img.width - WIDTH * MOVE_PIECES, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW
|
||||||
|
|
||||||
turn--;
|
turn--;
|
||||||
@ -51,10 +51,6 @@ function turn_left()
|
|||||||
|
|
||||||
function turn_right()
|
function turn_right()
|
||||||
{
|
{
|
||||||
//MOVE AN 8th TO LEFT
|
|
||||||
x1 += WIDTH * MOVE_PIECES;
|
|
||||||
x2 += WIDTH * MOVE_PIECES;
|
|
||||||
|
|
||||||
if (turn > 0 && (Math.abs(turn) - (1/MOVE_PIECES / 2)) >= 0)
|
if (turn > 0 && (Math.abs(turn) - (1/MOVE_PIECES / 2)) >= 0)
|
||||||
{
|
{
|
||||||
//ctx.drawImage(img, img.width - WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), 0, img.width, img.height, 0, 0, WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), WIDTH * ASPECT_RATIO); //DRAW RIGHT PART ON THE LEFT SIDE //TODO
|
//ctx.drawImage(img, img.width - WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), 0, img.width, img.height, 0, 0, WIDTH * MOVE_PIECES * (Math.abs(turn) - (1/MOVE_PIECES / 2)), WIDTH * ASPECT_RATIO); //DRAW RIGHT PART ON THE LEFT SIDE //TODO
|
||||||
@ -62,6 +58,10 @@ function turn_right()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MOVE AN 8th TO LEFT
|
||||||
|
x1 += WIDTH * MOVE_PIECES;
|
||||||
|
x2 += WIDTH * MOVE_PIECES;
|
||||||
|
|
||||||
ctx.drawImage(img, x1, 0, img.width + WIDTH * MOVE_PIECES, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW
|
ctx.drawImage(img, x1, 0, img.width + WIDTH * MOVE_PIECES, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW
|
||||||
|
|
||||||
turn++;
|
turn++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user