[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/
browsergame pixijs rapier2d roguelike shoot-em-up typescript webgame
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #10 from flo-bit/main

less flickering

authored by

Florian and committed by
GitHub
(Jul 27, 2024, 7:38 AM +0200) c15b3e0c ddd7ce67

+23 -13
+10 -6
src/app.ts
··· 47 47 48 48 debug: boolean = false; 49 49 50 - showStats: boolean = true; 50 + showStats: boolean = false; 51 51 52 52 stats?: Stats; 53 53 ··· 78 78 this.lightManager = new LightManager(this); 79 79 80 80 sound.add('music-intro', { 81 - url: './music-intro.mp3' 81 + url: './music-intro.mp3', 82 + volume: 0.3 82 83 }); 83 - sound.add('music', { url: './music.mp3', loop: true }); 84 - sound.add('laser', { url: './laser.mp3', volume: 0.3 }); 84 + sound.add('music', { url: './music.mp3', loop: true, volume: 0.3 }); 85 + sound.add('laser', { url: './laser.mp3', volume: 0.1 }); 85 86 } 86 87 87 88 async setupPhysicsWorld() { ··· 192 193 const interpolationSpeed = 0.05; 193 194 const interpolationFactor = 1 - Math.pow(1 - interpolationSpeed, deltaTime / (1000 / 60)); 194 195 195 - this.container.x += (position.x - this.container.x) * interpolationFactor; 196 - this.container.y += (position.y - this.container.y) * interpolationFactor; 196 + //this.container.x += (position.x - this.container.x) * interpolationFactor; 197 + //this.container.y += (position.y - this.container.y) * interpolationFactor; 198 + 199 + this.container.x = position.x; 200 + this.container.y = position.y; 197 201 } 198 202 199 203 if (this.stats) this.stats.end();
+11 -5
src/light.ts
··· 44 44 45 45 detail: number = 120; 46 46 47 + shape?: PIXI.Graphics; 48 + 47 49 constructor(game: Game, options: LightOptions) { 48 50 this.game = game; 49 51 ··· 65 67 if (options.detail) this.detail = options.detail; 66 68 if (options.flicker !== undefined) this.flicker = options.flicker; 67 69 70 + if (this.game.debug) { 71 + this.shape = new PIXI.Graphics().circle(0, 0, 5).fill(this.color); 72 + this.lightContainer.addChild(this.shape); 73 + } 68 74 this.createLight(); 69 75 70 76 this.game.container.addChild(this.lightContainer); ··· 146 152 const rays = this.detail; 147 153 148 154 const angleStep = (Math.PI * 2) / rays; 149 - const rayLength = 100000; 155 + const rayLength = 10000000; 150 156 151 157 let firstPoint; 152 158 ··· 178 184 this.shadow.lineTo(firstPoint.x, firstPoint.y); 179 185 } 180 186 } 181 - this.shadow.fill(0); 187 + this.shadow.fill(0, 0); 182 188 } 183 189 184 190 update(deltaTime: number) { ··· 190 196 this.light.alpha = this._alpha + (Math.random() - 0.5) * 0.03; 191 197 this.light.scale.set(this._scale + Math.random() * 0.1); 192 198 193 - if (Math.random() < 1 / deltaTime) { 194 - this.light.alpha = this._alpha * 0.5; 195 - } 199 + // if (Math.random() < 1 / deltaTime) { 200 + // this.light.alpha = this._alpha * 0.5; 201 + // } 196 202 } 197 203 } 198 204
+2 -2
src/player.ts
··· 92 92 this.leftEye = new Eye(this.playerContainer, -this.size / 4, 0); 93 93 this.rightEye = new Eye(this.playerContainer, this.size / 4, 0); 94 94 95 - this.x = 280; 96 - this.y = 340; 95 + this.x = 0; 96 + this.y = 0; 97 97 } 98 98 99 99 createHealthBar() {