Skip to content

Commit

Permalink
🐛 disallow new drops while queuedrop is going on
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Oct 25, 2021
1 parent 05eac23 commit 134f34f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drop-game/static/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ export default class Game extends Phaser.Scene {
this.pad.x = (this.pad.width / 2)
+ (Math.random() * (constants.SCREEN_WIDTH - this.pad.width));
this.pad.setVisible(true);

if (this.queue)
this.droppersQueue = {};
}

end() {
this.active = false;
this.queue = false;
this.droppersQueue = {};
this.pad.setVisible(false);

for (let drop of this.droppersArray)
Expand All @@ -128,6 +126,7 @@ export default class Game extends Phaser.Scene {
}

resolveQueue() {
this.start();
twitch.say(qs.channel, 'Let\'s goooooooooooo! PogChamp')

for (let dropper of Object.keys(this.droppersQueue))
Expand Down Expand Up @@ -184,9 +183,12 @@ export default class Game extends Phaser.Scene {
// events

onDrop(username, queue = false) {
if (!this.active)
if (!this.active && !this.queue)
this.start();
else if (this.queue && !queue
else if (this.active && this.queue && !queue)
return;

if (this.queue && !queue
&& this.droppersQueue.hasOwnProperty(username))
{
return;
Expand Down

0 comments on commit 134f34f

Please sign in to comment.