WIP
This commit is contained in:
+2
-2
@@ -99,8 +99,8 @@ export function drawSprite(
|
|||||||
yStart,
|
yStart,
|
||||||
sheet.frameWidth,
|
sheet.frameWidth,
|
||||||
sheet.frameHeight,
|
sheet.frameHeight,
|
||||||
x,
|
Math.round(x),
|
||||||
y,
|
Math.round(y),
|
||||||
width || sheet.frameWidth,
|
width || sheet.frameWidth,
|
||||||
height || sheet.frameHeight,
|
height || sheet.frameHeight,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ process((id, delta) => {
|
|||||||
if (pointer.isDown) {
|
if (pointer.isDown) {
|
||||||
position.x = pointer.position.x;
|
position.x = pointer.position.x;
|
||||||
position.y = pointer.position.y;
|
position.y = pointer.position.y;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
velocity.x -= keyboardInput.arrowLeft ? 1 : 0;
|
velocity.x -= keyboardInput.arrowLeft ? 1 : 0;
|
||||||
@@ -48,8 +49,8 @@ process((id, delta) => {
|
|||||||
normalize(velocity);
|
normalize(velocity);
|
||||||
scale(velocity, speed);
|
scale(velocity, speed);
|
||||||
|
|
||||||
position.x = Math.round(velocity.x * delta + position.x);
|
position.x += velocity.x * delta;
|
||||||
position.y = Math.round(velocity.y * delta + position.y);
|
position.y += velocity.y * delta;
|
||||||
|
|
||||||
velocity.x = 0;
|
velocity.x = 0;
|
||||||
velocity.y = 0;
|
velocity.y = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user