Почему появляется эта ошибка, заранее спасибо, вот код
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>engine</title>
</head>
<body>
<canvas width="500px" height="500" id="2d">
</canvas>
<script>
var canvas = document.getElementById("2d");
var ctx = canvas.getContext("2d");
var cvs = {x: 500, y: 500};
function draw_circle (linewidth, x, y, radius, colorofborder, coloroffill, fill) {
ctx.lineWidth = linewidth;
ctx.strokeStyle = colorofborder;
ctx.fillStyle = coloroffill;
ctx.beginPath();
ctx.arc (x, y, radius, 0, Math.PI*2, false);
if (fill === false) {ctx.stroke();}
else if (fill === true) {ctx.fill();}
};
// -------------------------------------------------------------------------------
var gravity = 1;
var phys_objects = {};
// -------------------------------------------------------------------------------
function Prop (x, y, mass, radius) {
this.x = x;
this.y = y;
this.speed = {x: 20, y: 20};
this.mass = mass;
this.radius = radius;
};
Prop.__proto__.move = function () {
ctx.clearRect(0, 0, 500, 500);
this.x =+ this.speed.x;
this.y =+ this.speed.y;
this.speed.x--;
this.speed.y = this.mass;
draw_circle(this.x, this.y, this.radius, "black", "red", true);
draw_circle(this.x, this.y, this.radius, "black", "red", false);
};
Prop.__proto__.check_collision = function () {
if (this.speed.x != 0 || this.speed.y != 0) {
if (this.x < this.radius || this.x > cvs.x-this.radius) {
this.speed.x = (-this.speed.x)/2;
}
else if (this.y < this.radius || this.y > cvs.y+this.radius) {
this.speed.y = (-this.speed.y)/2;
} } else {return;}
};
// Start test!
var ball = new Prop (50, 50, 10, 25);
var time = setInterval(function() {
ball.move();
ball.check_collision();}, 1000);
</script>
</body>
</html>