Malisa Huzaifa - Web Multimedia HTML6 Canvas & SVG

73 } function component(width, height, color, x, y, type) { this.type = type; this.width = width; this.height = height; this.speed = 1; this.angle = 0; this.moveAngle = 1; this.x = x; this.y = y; this.update = function() { ctx = myGameArea.context; ctx.save(); ctx.translate(this.x, this.y); ctx.rotate(this.angle); ctx.fillStyle = color; ctx.fillRect(this.width / -2, this.height / -2, this.width, this.height); ctx.restore(); ctx.beginPath(); ctx.arc(150, 150, 100, 0, 2*Math.PI); ctx.fillStyle ="skyblue"; ctx.fill(); }

RkJQdWJsaXNoZXIy MTM3NDc5MQ==