Skip to content

Commit

Permalink
Put some items down
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcticFqx committed Nov 19, 2023
1 parent b998f0c commit d4a1df4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/scenes/ShopState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ const shopItems: Item[] = [
}
];

import Vector2 = Phaser.Math.Vector2;

const itemPositions: Vector2[] = [
new Vector2( 0, 0 ),
new Vector2( 1, 0 ),
new Vector2( 2, 0 ),
new Vector2( 3, 0 ),
new Vector2( 0, 2 ),
];


export class ShopState extends Phaser.GameObjects.Container {
public scene: GameScene;

Expand Down Expand Up @@ -79,7 +90,14 @@ export class ShopState extends Phaser.GameObjects.Container {

populateShop() {
this.itemsForSale = shopItems;
const Wstart = this.scene.W * 0.5;
const Hstart = this.scene.H * 0.375;
const Wdist = this.scene.W * 0.13;
const Hdist = this.scene.H * 0.15;

const items = itemPositions.map((pos, i) =>
this.scene.add.image(Wstart + pos.x * Wdist, Hstart + pos.y * Hdist, 'screw').setScale(1.1)
);
}

update(time: number, delta: number) {
Expand Down

0 comments on commit d4a1df4

Please sign in to comment.