Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Se arreglo rebote de pala #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions 02-arkanoid-game/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
}

function paddleMovement() {
if (rightPressed && paddleX < canvas.width - paddleWidth) {
if (rightPressed && !leftPressed && paddleX < canvas.width - paddleWidth) {
paddleX += PADDLE_SENSITIVITY
} else if (leftPressed && paddleX > 0) {
} else if (leftPressed && !rightPressed && paddleX > 0) {
paddleX -= PADDLE_SENSITIVITY
}
}
Expand Down Expand Up @@ -232,7 +232,7 @@

// a que velocidad de fps queremos que renderice nuestro juego
const fps = 60

let msPrev = window.performance.now()
let msFPSPrev = window.performance.now() + 1000;
const msPerFrame = 1000 / fps
Expand All @@ -252,8 +252,7 @@

frames++

if (msFPSPrev < msNow)
{
if (msFPSPrev < msNow) {
msFPSPrev = window.performance.now() + 1000
framesPerSec = frames;
frames = 0;
Expand Down