Play sounds very near the player at full volume, but spatialize chip pickups
This commit is contained in:
parent
a088e50b3b
commit
15a8be1c15
10
js/game.js
10
js/game.js
@ -2556,18 +2556,18 @@ export class Level extends LevelInterface {
|
|||||||
tile[key] = val;
|
tile[key] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
collect_chip() {
|
collect_chip(actor) {
|
||||||
if (this.chips_remaining > 0) {
|
if (this.chips_remaining > 0) {
|
||||||
if (this.chips_remaining > 1) {
|
if (this.chips_remaining > 1) {
|
||||||
this.sfx.play_once('get-chip');
|
this.sfx.play_once('get-chip', actor.cell);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.sfx.play_once('get-chip-last');
|
this.sfx.play_once('get-chip-last', actor.cell);
|
||||||
}
|
}
|
||||||
this.chips_remaining--;
|
this.chips_remaining -= 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.sfx.play_once('get-chip-extra');
|
this.sfx.play_once('get-chip-extra', actor.cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -270,11 +270,11 @@ class SFXPlayer {
|
|||||||
if ('positionX' in listener) {
|
if ('positionX' in listener) {
|
||||||
listener.positionX.value = 0;
|
listener.positionX.value = 0;
|
||||||
listener.positionY.value = 0;
|
listener.positionY.value = 0;
|
||||||
listener.positionZ.value = -8;
|
listener.positionZ.value = -7;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Old way, only one Firefox supports atm ú_ù
|
// Old way, only one Firefox supports atm ú_ù
|
||||||
listener.setPosition(0, 0, -8);
|
listener.setPosition(0, 0, -7);
|
||||||
}
|
}
|
||||||
if ('forwardX' in listener) {
|
if ('forwardX' in listener) {
|
||||||
listener.forwardX.value = 0;
|
listener.forwardX.value = 0;
|
||||||
@ -465,7 +465,7 @@ class SFXPlayer {
|
|||||||
listener.positionY.value = y;
|
listener.positionY.value = y;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
listener.setPosition(x, y, -8);
|
listener.setPosition(x, y, -7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1340,7 +1340,7 @@ const TILE_TYPES = {
|
|||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
||||||
item_priority: PICKUP_PRIORITIES.real_player,
|
item_priority: PICKUP_PRIORITIES.real_player,
|
||||||
on_pickup(me, level, other) {
|
on_pickup(me, level, other) {
|
||||||
level.collect_chip();
|
level.collect_chip(me);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
// Not affected by gray buttons
|
// Not affected by gray buttons
|
||||||
@ -3105,7 +3105,7 @@ const TILE_TYPES = {
|
|||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
||||||
item_priority: PICKUP_PRIORITIES.real_player,
|
item_priority: PICKUP_PRIORITIES.real_player,
|
||||||
on_pickup(me, level, other) {
|
on_pickup(me, level, other) {
|
||||||
level.collect_chip();
|
level.collect_chip(me);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -3115,7 +3115,7 @@ const TILE_TYPES = {
|
|||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
||||||
item_priority: PICKUP_PRIORITIES.real_player,
|
item_priority: PICKUP_PRIORITIES.real_player,
|
||||||
on_pickup(me, level, other) {
|
on_pickup(me, level, other) {
|
||||||
level.collect_chip();
|
level.collect_chip(me);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user