This commit is contained in:
David Négrier 2020-07-23 18:47:28 +02:00
parent 2484e4f1df
commit d48d5b0285
5 changed files with 16 additions and 15 deletions

View file

@ -18,7 +18,7 @@ export class ActionableItem {
* OR null if we are out of range.
*/
public actionableDistance(x: number, y: number): number|null {
let distanceSquared = (x - this.sprite.x)*(x - this.sprite.x) + (y - this.sprite.y)*(y - this.sprite.y);
const distanceSquared = (x - this.sprite.x)*(x - this.sprite.x) + (y - this.sprite.y)*(y - this.sprite.y);
if (distanceSquared < this.activationRadiusSquared) {
return distanceSquared;
} else {

View file

@ -15,7 +15,7 @@ export default {
},
factory: (scene: GameScene, object: ITiledMapObject): ActionableItem => {
// Idée: ESSAYER WebPack? https://paultavares.wordpress.com/2018/07/02/webpack-how-to-generate-an-es-module-bundle/
let foo = new Sprite(scene, object.x, object.y, 'computer');
const foo = new Sprite(scene, object.x, object.y, 'computer');
scene.add.existing(foo);
return new ActionableItem(foo, 32);