You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
478 B
JavaScript

import { GRAVITY } from './level/def'
/** physics gets input like
instance of Moveable,
position: [x, y],
surroundings: [top, right, bottom, left] where each is a block type
and updates the Moveable instance values accordingly
*/
export class Moveable {
constructor (x, y, direction = 1) {
this.x = x
this.y = y
this.dir = direction
this.vx = 0
this.vy = 0
}
get direction () {
return this.dir > 0 ? 'left' : 'right'
}
}