Commit 653ab2f2 authored by Hubert Denkmair's avatar Hubert Denkmair

different tv views

parent bd7c06f9
......@@ -168,6 +168,7 @@ Game.prototype.HandleBotStatsMessage = function(data)
arr.push(data[id]);
}
arr.sort(function(a,b) { return b.m-a.m; });
this.stats = arr;
for (let d of arr.slice(0, 20))
{
let snake = this.vis.GetSnake(d.id);
......
......@@ -46,5 +46,30 @@
{
game.vis.Resize();
};
let currentView = 0;
window.setInterval(function() {
currentView = (currentView + 1) % 10;
if (currentView==0)
{
game.vis.Unfollow();
let vp = game.vis.viewport;
let scale = vp._screenWidth / game.vis.world_size_x;
vp.scale.x = scale;
vp.scale.y = scale;
vp.position.set(0, 0);
}
else if (currentView>5)
{
let index = currentView-5;
if (game.stats && (game.stats.length > index))
{
let snake_id = game.stats[index].id;
let snake = game.vis.GetSnake(snake_id);
game.vis.FollowName(snake.GetName(), true);
}
}
}, 3000);
</script>
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment