Skip to content

Commit

Permalink
save imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Sep 23, 2024
1 parent 63c6064 commit e11838a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import { PhysicsEntity } from "./entities/phys/physicsEntity";
import { getAssets } from "./assets";
import { GameDebugOverlay } from "./overlay";
import { GameWorld } from "./world";
import RAPIER from "@dimforge/rapier2d";
import RAPIER from "@dimforge/rapier2d-compat";
import { Worm } from "./entities/phys/worm";
import { readAssetsForEntities } from "./entities";

const worldWidth = 1920;
const worldHeight = 1080;


export class Game {
public readonly viewport: Viewport;
private readonly rapierWorld: RAPIER.World;
Expand All @@ -29,6 +30,7 @@ export class Game {
}

public static async create(window: Window, level: string): Promise<Game> {
await RAPIER.init();
const pixiApp = new Application();
await pixiApp.init({ resizeTo: window, preference: 'webgl' });
return new Game(pixiApp, level);
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/bodyWireframe..ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Graphics, Text } from "pixi.js";
import { PIXELS_PER_METER, RapierPhysicsObject } from "../world";
import { Cuboid, RoundCuboid } from "@dimforge/rapier2d";
import { Cuboid, RoundCuboid } from "@dimforge/rapier2d-compat";

/**
* Render a wireframe in pixi.js around a matter body.
Expand Down
2 changes: 1 addition & 1 deletion src/overlay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container, Graphics, Text, Ticker, UPDATE_PRIORITY } from "pixi.js";
import globalFlags from "./flags";
import RAPIER from "@dimforge/rapier2d";
import RAPIER from "@dimforge/rapier2d-compat";
import { PIXELS_PER_METER } from "./world";
import { Viewport } from "pixi-viewport";

Expand Down
2 changes: 1 addition & 1 deletion src/terrain/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Vector2 } from "@dimforge/rapier2d";
import { Vector2 } from "@dimforge/rapier2d-compat";
import { Rectangle } from "pixi.js";

export function imageDataToTerrainBoundaries(boundaryX: number, boundaryY: number, imgData: ImageData): { boundaries: Vector2[], boundingBox: Rectangle} {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Vector, Vector2 } from "@dimforge/rapier2d";
import { Vector, Vector2 } from "@dimforge/rapier2d-compat";
export { Coordinate, MetersValue } from "./coodinate";


Expand Down
2 changes: 1 addition & 1 deletion src/weapons/grenade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IWeaponCode, IWeaponDefiniton } from "./weapon";
import { Worm } from "../entities/phys/worm";
import { Game } from "../game";
import { GameWorld } from "../world";
import { Vector2 } from "@dimforge/rapier2d";
import { Vector2 } from "@dimforge/rapier2d-compat";
import { add } from "../utils";

export const WeaponGrenade: IWeaponDefiniton = {
Expand Down
2 changes: 1 addition & 1 deletion src/world.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IGameEntity, IMatterEntity } from "./entities/entity";
import { Ticker, UPDATE_PRIORITY } from "pixi.js";
import { Viewport } from "pixi-viewport";
import { Ball, Collider, ColliderDesc, EventQueue, RigidBody, RigidBodyDesc, Vector2, World } from "@dimforge/rapier2d";
import { Ball, Collider, ColliderDesc, EventQueue, RigidBody, RigidBodyDesc, Vector2, World } from "@dimforge/rapier2d-compat";
import { Coordinate, MetersValue } from "./utils/coodinate";

/**
Expand Down

0 comments on commit e11838a

Please sign in to comment.