Game settings change
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
Original
|
Original
|
||||||
</b-radio-button>
|
</b-radio-button>
|
||||||
<b-radio-button v-model="music" native-value="2">
|
<b-radio-button v-model="music" native-value="2">
|
||||||
Ambiance
|
None
|
||||||
</b-radio-button>
|
</b-radio-button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
@@ -31,7 +31,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
music: 0
|
music: '2'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -47,7 +47,6 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
music: function (music) {
|
music: function (music) {
|
||||||
console.log('MUSIC ' + music)
|
|
||||||
sound.stopBackgroundMusic()
|
sound.stopBackgroundMusic()
|
||||||
sound.startBackgroundMusic(music)
|
sound.startBackgroundMusic(music)
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,4 @@
|
|||||||
const music1 = new Audio(require('@/assets/sound/revengeOfCats.mp3'))
|
const music1 = new Audio(require('@/assets/sound/revengeOfCats.mp3'))
|
||||||
const music2 = new Audio(require('@/assets/sound/1992.mp3'))
|
|
||||||
// const motor = new Audio(require('@/assets/sound/motor.mp3'))
|
|
||||||
const explosion = new Audio(require('@/assets/sound/explosion.mp3'))
|
const explosion = new Audio(require('@/assets/sound/explosion.mp3'))
|
||||||
const taunt = new Audio(require('@/assets/sound/tmauvais.mp3'))
|
const taunt = new Audio(require('@/assets/sound/tmauvais.mp3'))
|
||||||
|
|
||||||
@@ -9,31 +7,18 @@ explosion.volume = 0.2
|
|||||||
|
|
||||||
music1.loop = true
|
music1.loop = true
|
||||||
music1.volume = 0.2
|
music1.volume = 0.2
|
||||||
music2.loop = true
|
|
||||||
music2.volume = 0.2
|
|
||||||
|
|
||||||
export const sound = {
|
export const sound = {
|
||||||
startBackgroundMusic (n) {
|
startBackgroundMusic (n) {
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case '1': music1.play(); break
|
case '1': music1.play(); break
|
||||||
case '2': music2.play(); break
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stopBackgroundMusic () {
|
stopBackgroundMusic () {
|
||||||
music1.pause()
|
music1.pause()
|
||||||
music2.pause()
|
|
||||||
},
|
},
|
||||||
explosion () {
|
explosion () {
|
||||||
if (Math.floor(Math.random() * Math.floor(10)) === 0) taunt.play()
|
if (Math.floor(Math.random() * Math.floor(10)) === 0) taunt.play()
|
||||||
explosion.play()
|
explosion.play()
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
startMotor () {
|
|
||||||
motor.loop = true
|
|
||||||
motor.play()
|
|
||||||
},
|
|
||||||
stopMotor () {
|
|
||||||
motor.pause()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export default function createSocketPlugin () {
|
|||||||
|
|
||||||
connection.onerror = function (error) {
|
connection.onerror = function (error) {
|
||||||
console.log('[WS] error ' + error.message)
|
console.log('[WS] error ' + error.message)
|
||||||
// store.dispatch('game/error', 'Connection problem')
|
|
||||||
Toast.open('Connection problem. Retrying in 10s...')
|
Toast.open('Connection problem. Retrying in 10s...')
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function login (connection, name) {
|
|||||||
gameSettings: gameSettings
|
gameSettings: gameSettings
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if (updateInterval === -1) updateInterval = setInterval(() => step(), 1000)
|
if (updateInterval === -1) updateInterval = setInterval(() => step(), 1000 / 60)
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout (connection) {
|
function logout (connection) {
|
||||||
@@ -63,7 +63,7 @@ function kill (player) {
|
|||||||
function step () {
|
function step () {
|
||||||
const currentTime = Date.now()
|
const currentTime = Date.now()
|
||||||
const durationSinceLastUpdate = (currentTime - lastUpdateTime) / 1000
|
const durationSinceLastUpdate = (currentTime - lastUpdateTime) / 1000
|
||||||
const tickToSimulate = (durationSinceLastUpdate * 120) / 1000
|
const tickToSimulate = (durationSinceLastUpdate * 60) / 1000
|
||||||
lastUpdateTime = currentTime
|
lastUpdateTime = currentTime
|
||||||
|
|
||||||
// console.log('UPDATE ' + currentTime + ' doUpdate ' + doUpdate)
|
// console.log('UPDATE ' + currentTime + ' doUpdate ' + doUpdate)
|
||||||
@@ -102,12 +102,11 @@ function step () {
|
|||||||
|
|
||||||
function broadcastUpdate () {
|
function broadcastUpdate () {
|
||||||
const update = {
|
const update = {
|
||||||
type: 'update',
|
type: 'gameUpdate',
|
||||||
players: Object.values(players),
|
players: Object.values(players),
|
||||||
time: lastUpdateTime
|
time: lastUpdateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Broadcast ' + JSON.stringify(update))
|
|
||||||
Object.values(sockets).forEach((connection) => {
|
Object.values(sockets).forEach((connection) => {
|
||||||
connection.send(JSON.stringify(update))
|
connection.send(JSON.stringify(update))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module.exports = Object.freeze({
|
module.exports = Object.freeze({
|
||||||
playerSize: 10,
|
playerSize: 10,
|
||||||
playerSpeed: 2.3,
|
playerSpeed: 5,
|
||||||
playerTurnSpeed: 10,
|
playerTurnSpeed: 10,
|
||||||
wallSize: 8,
|
wallSize: 8,
|
||||||
wallUpdate: 20,
|
wallUpdate: 5,
|
||||||
arenaSize: 1000
|
arenaSize: 1000
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user