Commit 724233ea authored by Yannick Armand's avatar Yannick Armand

Mise en forme du code source

parent 253e9783
import Game from '../Game'
import Point from '../Point'
import Circle from '../Circle'
import Entity from '../Entity'
import Game from '../Game'
import Point from '../Point'
export default abstract class Block implements Entity {
private game: Game
......@@ -54,6 +54,26 @@ export default abstract class Block implements Entity {
return this.position
}
public getCenter(): Point {
const middle = this.getMiddle()
return new Point(
this.position.getX() + middle.getX(),
this.position.getY() + middle.getY(),
)
}
public getCircle(): Circle {
const position = this.getCenter()
const radius = (this.width + this.height) / 4
return new Circle(position.getX(), position.getY(), radius)
}
public getCollisionShape() {
return this.getCircle()
}
protected getGame(): Game {
return this.game
}
......@@ -80,27 +100,7 @@ export default abstract class Block implements Entity {
private getMiddle(): Point {
return new Point(
this.width / 2,
this.height / 2
this.height / 2,
)
}
public getCenter(): Point {
const middle = this.getMiddle()
return new Point(
this.position.getX() + middle.getX(),
this.position.getY() + middle.getY()
)
}
public getCircle(): Circle {
const position = this.getCenter()
const radius = (this.width + this.height) / 4
return new Circle(position.getX(), position.getY(), radius)
}
public getCollisionShape() {
return this.getCircle()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment