Camera implemented.

This commit is contained in:
Mal
2020-02-09 22:06:59 +01:00
parent d43cd56d65
commit f6890eec24
8 changed files with 116 additions and 23 deletions

View File

@@ -40,6 +40,14 @@ export default class Movable
return this.animations[this.currentAnimation].getRect();
}
getCenter()
{
return new GeometryPoint(
this.position.x + this.getWidth() * 0.5,
this.position.y + this.getHeight() * 0.5
);
}
getWidth()
{
return this.getRect().width;
@@ -99,9 +107,9 @@ export default class Movable
this.position.y = height - this.animations[this.currentAnimation].getHeight();
}
draw(context)
draw(context, camera)
{
this.animations[this.currentAnimation].setFootPosition(this.position.x, this.position.y);
this.animations[this.currentAnimation].draw(context);
this.animations[this.currentAnimation].draw(context, camera);
}
}