hextris/entities.js

26 lines
465 B
JavaScript
Raw Normal View History

2014-05-17 14:43:16 +00:00
//you can change these to sexier stuff
var colors = [
"black",
"orange",
"red",
"blue",
];
2014-05-17 14:24:39 +00:00
var Clock = function(sides) {
2014-05-17 15:03:11 +00:00
this.position = 0;
2014-05-17 14:24:39 +00:00
this.sides = sides;
this.blocks = [];
for(var i=0; i<sides; i++) {
this.blocks.push([]);
}
2014-05-17 15:03:11 +00:00
this.addBlock = function(block) {
this.blocks[this.position].push(block);
}
this.rotate = function(steps) {
this.position += steps;
this.position = Math.abs(((this.position%sides)+this.position) % sides);
}
2014-05-17 14:24:39 +00:00
}