Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/flo-bit/shadow-shmup. Fun and casual top-down, roguelike shoot 'em up browsergame with shadow elements and colorful neon effects
flo-bit.dev/shadow-shmup/
···11-import Player from './player.js';
22-import EnemyManager from './enemy-manager.js';
31import * as PIXI from 'pixi.js';
42import { type World, EventQueue } from '@dimforge/rapier2d';
55-import { RAPIER } from './rapier.js';
66-import ParticleSystem from './particles.js';
77-import { Projectile } from './projectile.js';
88-import Enemy from './enemy.js';
33+import { RAPIER } from './helper/rapier.js';
94105import Stats from 'stats.js';
116127import { AdvancedBloomFilter } from 'pixi-filters';
1313-import PlayerManager from './player-manager.js';
1414-import ProjectileManager, { ProjectileData } from './projectile-manager.js';
88+import { sound } from '@pixi/sound';
1591616-import { sound } from '@pixi/sound';
1717-import Controls from './controls.js';
1818-import { ObstacleManager } from './obstacle-manager.js';
1010+import ParticleSystem from './visuals/particles.js';
1111+import { Projectile } from './weapons/projectile.js';
1212+import Enemy from './enemies/enemy.js';
1313+import Player from './player/player.js';
1414+import EnemyManager from './enemies/enemy-manager.js';
1515+1616+import PlayerManager from './player/player-manager.js';
1717+import ProjectileManager, { ProjectileData } from './weapons/projectile-manager.js';
1818+1919+import Controls from './helper/controls.js';
2020+import { ObstacleManager } from './map/obstacle-manager.js';
1921import { WaveManager } from './wave.js';
2020-import { Item, ItemOptions } from './item.js';
2121-import { ItemManager } from './item-manager.js';
2222-import { LightManager } from './light-manager.js';
2323-import { createNoiseSprite } from './helper.js';
2424-import { UpgradeManager } from './upgrade-manager.js';
2222+import { Item, ItemOptions } from './coins/coin.js';
2323+import { ItemManager } from './coins/coin-manager.js';
2424+import { LightManager } from './visuals/light-manager.js';
2525+import { createNoiseSprite } from './helper/helper.js';
2626+import { UpgradeManager } from './upgrades/upgrade-manager.js';
2527import { Weapon } from './weapons/weapon.js';
26282729export default class Game {
···122124 let gravity = new RAPIER.Vector2(0.0, 0.0);
123125 let world = new RAPIER.World(gravity);
124126127127+ // @ts-ignore
125128 window.RAPIER = RAPIER;
126129 this.world = world;
127130 }
···137140 createStats() {
138141 this.stats = new Stats();
139142 document.body.appendChild(this.stats.dom);
143143+ }
144144+145145+ showText(x: number, y: number, color: number, text: string) {
146146+ const style = new PIXI.TextStyle({
147147+ fontFamily: 'Arial',
148148+ fontSize: 36,
149149+ fill: color,
150150+ align: 'center'
151151+ });
152152+153153+ // Create the text object
154154+ const richText = new PIXI.Text({ text, style });
155155+156156+ richText.anchor.set(0.5);
157157+ // Position the text
158158+159159+ richText.position.set(x, y);
160160+161161+ // Add the text to the stage
162162+ this.container.addChild(richText);
140163 }
141164142165 removeStats() {
···329352330353 if (enemy && projectile) {
331354 this.spawnParticles(projectile.shape.x, projectile.shape.y, 10, projectile.color);
355355+356356+ this.showText(enemy.x, enemy.y, projectile.color, projectile.damage.toString());
332357333358 enemy.impulse(projectile.vx * 200000, -projectile.vy * 200000);
334359 enemy.takeDamage(projectile.damage);
+1-1
src/controls.ts
src/helper/controls.ts
···11-import Game from './app';
11+import Game from '../app';
2233export default class Controls {
44 keys: Record<string, boolean> = {};
+2-2
src/enemy-manager.ts
src/enemies/enemy-manager.ts
···11import { Vector2 } from '@dimforge/rapier2d';
22-import Game from './app.js';
22+import Game from '../app.js';
33import Enemy, { PentagonEnemy, SphereEnemy, TriangleEnemy } from './enemy.js';
4455export default class EnemyManager {
···2323 addEnemy(enemyType: typeof Enemy = this.randomEnemyType()) {
2424 const enemy = new enemyType(this.game);
2525 this.enemies.push(enemy);
2626-2626+2727 return enemy;
2828 }
2929
+7-7
src/enemy.ts
src/enemies/enemy.ts
···11import * as PIXI from 'pixi.js';
22-import Game from './app';
33-import { RAPIER } from './rapier';
22+import Game from '../app';
33+import { RAPIER } from '../helper/rapier';
44import { Vector2, type RigidBody } from '@dimforge/rapier2d';
55-import Eye from './eye';
66-import Player from './player';
77-import { GunWeapon } from './weapons/gun';
88-import { Projectile } from './projectile';
55+import Eye from '../visuals/eye';
66+import Player from '../player/player';
77+import { GunWeapon } from '../weapons/gun';
88+import { Projectile } from '../weapons/projectile';
99import { sound } from '@pixi/sound';
10101111interface PlayerHit {
···718718719719 this.weapon.update(deltaTime);
720720 }
721721-}721721+}
src/eye.ts
src/visuals/eye.ts
src/helper.ts
src/helper/helper.ts
+2-2
src/item-manager.ts
src/coins/coin-manager.ts
···11-import Game from './app';
22-import { Item, ItemOptions } from './item';
11+import Game from '../app';
22+import { Item, ItemOptions } from './coin';
3344export class ItemManager {
55 items: Item[] = [];
+4-3
src/item.ts
src/coins/coin.ts
···11import { Collider, RigidBody } from '@dimforge/rapier2d';
22-import Game from './app';
32import * as PIXI from 'pixi.js';
44-import { RAPIER } from './rapier';
55-import Player from './player';
33+import { RAPIER } from '../helper/rapier';
44+55+import Game from '../app';
66+import Player from '../player/player';
6778export type ItemOptions = {
89 x: number;
src/light-manager.ts
src/visuals/light-manager.ts
+2-2
src/light.ts
src/visuals/light.ts
···11import * as PIXI from 'pixi.js';
22-import { RAPIER } from './rapier';
33-import Game from './app';
22+import { RAPIER } from '../helper/rapier';
33+import Game from '../app';
44import { RigidBody } from '@dimforge/rapier2d';
55// import 'pixi.js/advanced-blend-modes';
66
···11-import Game from './app';
11+import Game from '../app';
22import * as PIXI from 'pixi.js';
33import Obstacle from './obstacles';
4455import Alea from 'alea';
66-import { Light } from './light';
66+import { Light } from '../visuals/light';
7788const CELL_SIZE = 1200;
99const OBSTACLE_COUNT_PER_CELL = 40;
···252252 }
253253 });
254254 }
255255-}255255+}
+3-3
src/obstacles.ts
src/map/obstacles.ts
···11import { Collider } from '@dimforge/rapier2d';
22-import Game from './app';
33-import { RAPIER } from './rapier';
22+import Game from '../app';
33+import { RAPIER } from '../helper/rapier';
44import * as PIXI from 'pixi.js';
5566export default class Obstacle {
···4040 this.game.world.removeCollider(this.collider, false);
4141 this.container.removeChild(this.graphics);
4242 }
4343-}4343+}
···11-import Game from './app.js';
22-import Enemy from './enemy.js';
11+import Game from '../app.js';
32import Player from './player.js';
4354export default class PlayerManager {
+7-7
src/player.ts
src/player/player.ts
···11-import { GunWeapon } from './weapons/gun.js';
11+import { GunWeapon } from '../weapons/gun.js';
22import * as PIXI from 'pixi.js';
3344-import Game from './app';
55-import { RAPIER } from './rapier';
44+import Game from '../app.js';
55+import { RAPIER } from '../helper/rapier.js';
66import { type RigidBody } from '@dimforge/rapier2d';
77-import Eye from './eye.js';
88-import { Light } from './light.js';
99-import { blendColors } from './helper.js';
1010-import { Weapon } from './weapons/weapon.js';
77+import Eye from '../visuals/eye.js';
88+import { Light } from '../visuals/light.js';
99+import { blendColors } from '../helper/helper.js';
1010+import { Weapon } from '../weapons/weapon.js';
1111import { sound } from '@pixi/sound';
12121313export default class Player {
···11-import Game from './app';
11+import Game from '../app';
22import { Projectile } from './projectile';
3344export type ProjectileData = {
+2-2
src/projectile.ts
src/weapons/projectile.ts
···11import * as PIXI from 'pixi.js';
22-import { RAPIER } from './rapier';
33-import Game from './app';
22+import { RAPIER } from '../helper/rapier';
33+import Game from '../app';
44import { ProjectileData } from './projectile-manager';
5566export class Projectile {
+2
src/rapier.ts
src/helper/rapier.ts
···11export function RAPIER(): typeof import('@dimforge/rapier2d') {
22+ // @ts-ignore
23 if (!window.RAPIER) {
34 throw new Error('RAPIER is not initialized yet. Make sure to call setupPhysicsWorld() first.');
45 }
66+ // @ts-ignore
57 return window.RAPIER;
68}
-11
src/types/global.d.ts
···11-// src/types/global.d.ts
22-import * as RAPIER from '@dimforge/rapier2d';
33-44-export {};
55-66-declare global {
77- interface Window {
88- RAPIER: RAPIER;
99- world: any;
1010- }
1111-}
···11-import Game from './app';
22-import { Item } from './item';
11+import Game from '../app';
22+import { Item } from '../coins/coin';
33import { addUpgradeOption } from './upgrades';
44import { allUpgrades, Upgrade } from './upgrades-player';
55-6576export class UpgradeManager {
87 colors_classes = ['bg-sky-500', 'bg-pink-500', 'bg-emerald-500'];
···11-import Player from './player';
11+import Player from '../player/player';
22import { Icon } from './upgrades';
33-import { BallWeapon } from './weapons/ball';
44-import { Knife } from './weapons/knife';
33+import { BallWeapon } from '../weapons/ball';
44+import { Knife } from '../weapons/knife';
5566export type Upgrade = {
77 upgrade: (player: Player) => void;
src/upgrades.ts
src/upgrades/upgrades.ts
+1-1
src/wave.ts
···11import Game from './app';
22-import Enemy, { PentagonEnemy, SphereEnemy, TriangleEnemy } from './enemy';
22+import Enemy, { PentagonEnemy, SphereEnemy, TriangleEnemy } from './enemies/enemy';
3344type EnemySpawnConfig = {
55 type: typeof Enemy;
+1-1
src/weapons/ball.ts
···11import Game from '../app';
22import { Light } from '../light';
33import * as PIXI from 'pixi.js';
44-import { RAPIER } from '../rapier';
44+import { RAPIER } from '../helper/rapier';
55import { Collider, RigidBody } from '@dimforge/rapier2d';
66import { Weapon } from './weapon';
77
+1-1
src/weapons/burst.ts
···11import Game from '../app';
22import { Light } from '../light';
33import * as PIXI from 'pixi.js';
44-import { RAPIER } from '../rapier';
44+import { RAPIER } from '../helper/rapier';
55import { Collider, RigidBody } from '@dimforge/rapier2d';
66import { Weapon } from './weapon';
77import { GunWeapon } from './gun';
+1-1
src/weapons/gun.ts
···11import Game from '../app';
22-import { Projectile } from '../projectile';
22+import { Projectile } from './projectile';
3344import { sound } from '@pixi/sound';
55
+1-1
src/weapons/knife.ts
···11import Game from '../app';
22import { Light } from '../light';
33import * as PIXI from 'pixi.js';
44-import { RAPIER } from '../rapier';
44+import { RAPIER } from '../helper/rapier';
55import { Collider, RigidBody, Vector2 } from '@dimforge/rapier2d';
66import { Weapon } from './weapon';
77