-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogo.js
More file actions
executable file
·48 lines (44 loc) · 1.37 KB
/
logo.js
File metadata and controls
executable file
·48 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var PlayBoard = function (paper,xdim,ydim) {
this.paper = paper;
this.xdim = xdim; this.ydim = ydim;
var sqw = Math.floor(this.paper.width / xdim);
this.squares = this.squareInit(xdim,ydim,sqw);
}
PlayBoard.prototype.squareInit = function (x,y,w) {
var temp = [];
for (var ix=0;ix<x;ix++) {
temp[x] = [];
for (var iy=0;iy<y;iy++) {
temp[x][y] = new Square(this.paper,x,y,w);
}
}
};
var Square = function (paper,x,y,w) {
this.x = x;
this.y = y;
this.paper = paper;
var self = this;
this.shape = paper.rect((x-1)*w,(y-1)*w,x*w,y*w,6)
.attr({fill: '#fff',
stroke: '#222',
stroke-width: 4,
})
.click(function (evt) {
//click stuff here
});
this.occ = null;
}
var Player = function (board) {
this.board = board;
this.loc = this.setStartLoc();
this.color = this.setColor();
this.shape = //draw an SVG path
}
window.onload = function () {
var paper = new Raphael(document.getElementById('canvas_container'),600,700);
//var ticker, a plaintext field w scrollbars for the program
var board = new PlayBoard(paper,8,8);
var input = new InputField(paper,board,600); //y-value
board.initObstacles();
var sprite = new Player(board);
}