Added broken interpolation

This commit is contained in:
Thomas
2020-09-11 15:41:49 +02:00
parent 6ecbbdff42
commit 5fcc664f8f
7 changed files with 56 additions and 26 deletions

View File

@@ -16,6 +16,7 @@
<script>
import { send } from '@/store/socketPlugin'
import { render } from '@/game/render.js'
// import { update } from '@/game/update.js'
import { sound } from '@/game/sound.js'
export default {
@@ -32,7 +33,7 @@ export default {
},
stats: {
totalWalls: 0,
lastUpdateTime: 0,
lastUpdateTime: {},
lastFrame: 0
},
renderTimer: null
@@ -60,12 +61,6 @@ export default {
if (nextUpdate === undefined) return pastUpdate.players
return nextUpdate.players
/*
const currentTime = Date.now() / 1000
const dt = (currentTime - pastUpdate.time) / (nextUpdate.time - pastUpdate.time)
return pastUpdate.players.map(player => this.interpolatePlayer(player, nextUpdate.players.find(nextPlayer => player.color === nextPlayer.color), dt))
*/
},
isPaused () {
return this.$store.state.game.paused
@@ -91,6 +86,8 @@ export default {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)
render.borders(this.context, this.canvas, this.camera, this.settings)
// const players = update.computePlayers(this.$store.state.game.updates, this.$store.state.game.firstUpdateTime, this.$store.state.game.gameStartTime)
if (!this.players) return
this.stats.totalWalls = 0
@@ -102,7 +99,8 @@ export default {
if (player.state === 'DEAD') this.context.globalAlpha = 0.1
render.wallsBezier(this.context, this.canvas, this.camera, this.settings, player)
// render.wallsBezier(this.context, this.canvas, this.camera, this.settings, player)
render.walls(this.context, this.canvas, this.camera, this.settings, player)
if (player.name === 'e' || player.name === 'q' || player.name === 'r' || player.name === 't') render.playerFace(this.context, this.canvas, this.camera, this.settings, player, player.name)
else render.player(this.context, this.canvas, this.camera, this.settings, player)