class SectorStation { constructor(x, y) { this.sectorCoordinates = { x: x, y: y }; this.position = { x: 280, y: -700 }; this.dockPosition = { x: 280, y: 170 }; this.rotation = 0; this.velocity = { x: 0, y: 0 }; } init() { } getCoordinates() { return this.sectorCoordinates; } update(delta) { if (!game.ship.isDocked() && this.position.y < this.dockPosition.y) { this.position.y += this.velocity.y; } else if (!game.ship.isDocked()) { game.dockingFinished(); } //this.rotation += 0.1; this.rotation %= 360; } draw(context, delta) { this.update(delta); context.save(); context.translate(this.position.x + game.center.x, this.position.y + game.center.y); context.rotate(this.rotation * (Math.PI / 180)); game.atlas.drawCentered(context, "spaceStation_026.png", { x: 0, y: 0 }); context.restore(); } drawNav(context, gridSize, halfGridSize) { context.save(); context.translate(this.sectorCoordinates.x * gridSize + halfGridSize, this.sectorCoordinates.y * gridSize + halfGridSize); context.scale(0.05, 0.05); game.atlas.drawCentered(context, "spaceStation_026.png", { x: 0, y: 0 }); context.restore(); } handleResize(event) { } dock() { this.position = { x: 280, y: -700 }; this.velocity.y = 0.1; } }