Skip to content

Instantly share code, notes, and snippets.

@rafinskipg
Created March 6, 2020 07:26
Show Gist options
  • Save rafinskipg/c633725ac84819df511fb6f81b236691 to your computer and use it in GitHub Desktop.
Save rafinskipg/c633725ac84819df511fb6f81b236691 to your computer and use it in GitHub Desktop.
function update(dt) {
const speed = 100 // We can have a different speed per square if we want
figures.forEach(figure => {
figure.x = figure.x + (dt * speed ) > canvas.width ? 0 : figure.x + (dt * speed)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment