Gravity and ground height.

This commit is contained in:
Mal
2020-01-25 13:11:25 +01:00
parent 388799c97e
commit 0cd532f45a
8 changed files with 316 additions and 27 deletions

View File

@@ -46,6 +46,21 @@ export default class RetroSprite
return this.canvas.height;
}
getFootHeight()
{
return new GeometryPoint(this.position.x, this.position.y + this.getHeight());
}
getPositionLeftFoot()
{
return new GeometryPoint(this.position.x - this.getWidth() * 0.5, this.position.y);
}
getPositionRightFoot()
{
return new GeometryPoint(this.position.x + this.getWidth() * 0.5, this.position.y);
}
draw(context)
{
context.drawImage(this.canvas, this.position.x, this.position.y);