mirror of
https://github.com/neogeek23/neogeek23.github.io.git
synced 2026-02-04 02:48:17 +00:00
Add files via upload
This commit is contained in:
parent
3537ee526c
commit
0799c63f56
@ -165,6 +165,7 @@ class Snek{
|
|||||||
this.alive++;
|
this.alive++;
|
||||||
if (target.get_block_x() == this.head.get_block_x() && target.get_block_y() == this.head.get_block_y()){
|
if (target.get_block_x() == this.head.get_block_x() && target.get_block_y() == this.head.get_block_y()){
|
||||||
this.length++;
|
this.length++;
|
||||||
|
this.alive = 0;
|
||||||
var canvas_context = this.head.get_board();
|
var canvas_context = this.head.get_board();
|
||||||
var canvas = canvas_context.canvas;
|
var canvas = canvas_context.canvas;
|
||||||
return new Block(Math.floor(Math.random() * (canvas.width/(block_size + block_space) - 1)),
|
return new Block(Math.floor(Math.random() * (canvas.width/(block_size + block_space) - 1)),
|
||||||
@ -182,8 +183,8 @@ class Snek{
|
|||||||
var score_element = document.getElementsByClassName("points_scored")[0];
|
var score_element = document.getElementsByClassName("points_scored")[0];
|
||||||
var score_rate_element = document.getElementsByClassName("point_rate")[0];
|
var score_rate_element = document.getElementsByClassName("point_rate")[0];
|
||||||
|
|
||||||
score_element.innerHTML = ((this.length - initial_tail_length) * 10000).toString();
|
score_element.innerHTML = (this.length - initial_tail_length).toString();
|
||||||
score_rate_element.innerHTML = ((this.length - initial_tail_length)*10000/this.alive).toPrecision(5).toString();
|
score_rate_element.innerHTML = ((this.length - initial_tail_length) * 200/this.alive).toPrecision(5).toString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user