towerofnix / slw

name blatantly borrowed under fair use from @an-ok-squirrel
https://towerofnix.github.io/slw/
7 stars 2 forks source link

Make "camera" follow player #1

Closed towerofnix closed 8 years ago

towerofnix commented 8 years ago

Just modifying getDrawnPosition and let view(start/end)(x/y) should do it.. this is what I was having trouble with earlier, though! :P

bates64 commented 8 years ago

Should the camera be a class? (It'd allow us to move between different "active" cameras for cutscenes.)

class Camera {
  x: number
  y: number  

  constructor() {
    this.x = 0
    this.y = 0
  }
}

game.camera = new Camera

Also, Entities have their own drawing mechanisms, so something like CanvasRenderingContext2D.translate would be bettter!