diff --git a/index.html b/index.html
index cbf217b..556feac 100644
--- a/index.html
+++ b/index.html
@@ -2,6 +2,7 @@
Wasted Time
+
diff --git a/main.js b/main.js
index ff90fcd..9839eaa 100644
--- a/main.js
+++ b/main.js
@@ -11,16 +11,43 @@ window.requestAnimFrame = (function(){
};
})();
+var blocks = [];
+
+for (var i = 0; i < 6, i++) {
+ blocks.push(new Block(i, 'green'));
+}
+
(function animloop(){
requestAnimFrame(animloop);
render();
})();
-function render() {
+function Render() {
// game code
- requestAnimFrame(render);
+ blocks.forEach(function(o){
+ o.draw();
+ })
+
+ ctx.fillRect(200, 200, 200, 200);
}
-function block(lane) {
+function Block(lane, color, time) {
+ this.lane = lane;
+ this.angle = 15 * (Math.PI / 180) + 30 * (Math.PI / 180) * lane;
+ this.color = color;
+ this.draw = function() {
+ ctx.translate(canvas.width / 2, canvas.height / 2);
+ ctx.rotate(this.angle);
+ ctx.fillStyle = color;
+ ctx.fillRect(canvas.width/2 + Math.cos(this.angle) * time, canvas.height/2 + Math.sin(this.angle) * time, 70, 30);
+ ctx.restore();
+ };
+
+ if (!time) {
+ this.time = time;
+ }
+ else {
+ time = 200;
+ }
}
\ No newline at end of file