02 Game Loops
Intro to game loops
Note: This is not the only way to do this, this is just one simple way to do it. There are probably better or worse ways of doing this, so don’t be too confident with this approach!
A game loop is just an infinite loop that, con...
sudarshanrai.hashnode.dev5 min read
Challenge of bounce to-fro: modify in update() method
if(this.x===0){ this.count--; } if(this.x===canvas.width){ this.count++; } if(this.count===0){ this.x += this.speedX; this.y += this.speedY; } else{ this.x -= this.speedX; this.y -= this.speedY; }initially count is supposed to be 1