Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Sep 23, 2024
1 parent aaaa686 commit 3401ab2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/scenarios/testingGround.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async function runScenario(game: Game) {
game.viewport.follow(worm.sprite);

game.viewport.on('clicked', async (evt) => {
const position = { x: evt.world.x, y: evt.world.y };
const position = Coordinate.fromScreen(evt.world.x, evt.world.y);
const entity = await Grenade.create(parent, world, position, {x: 0.01, y: 0});
//const entity = await BazookaShell.create(game, parent, composite, position, 1, 0.01, 6);
world.addEntity(entity);
Expand Down
4 changes: 2 additions & 2 deletions src/weapons/grenade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Worm } from "../entities/phys/worm";
import { Game } from "../game";
import { GameWorld } from "../world";
import { Vector2 } from "@dimforge/rapier2d-compat";
import { add } from "../utils";
import { add, Coordinate } from "../utils";

export const WeaponGrenade: IWeaponDefiniton = {
code: IWeaponCode.Grenade,
Expand All @@ -15,6 +15,6 @@ export const WeaponGrenade: IWeaponDefiniton = {
console.log('Force component', forceComponent)
const force = new Vector2(1 * forceComponent, 0.001);
const position = add(worm.position, new Vector2(0, -50))
return Grenade.create(parent, world, position, force);
return Grenade.create(parent, world, Coordinate.fromScreen(position.x, position.y), force);
},
}
2 changes: 1 addition & 1 deletion src/weapons/weapon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export enum IWeaponCode {
export interface IWeaponDefiniton {
code: IWeaponCode,
maxDuration: number,
fireFn: (parent: Container, world: GameWorld, worm: Worm, duration: number) => PromiseLike<IGameEntity>,
fireFn: (parent: Container, world: GameWorld, worm: Worm, duration: number) => IGameEntity,
}

0 comments on commit 3401ab2

Please sign in to comment.