Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cx = 0; //x for full tile
- cy = 6; //y for full tile
- //Function invoked when the editor wants to know the group of same tiles
- function getSameTiles() {
- var ar = new Array();
- //standard 9 tiles block (outer edges + full tile)
- ar.push(new Array(cx + 0, cy + 0));
- ar.push(new Array(cx + 1, cy + 0));
- ar.push(new Array(cx + 2, cy + 0));
- ar.push(new Array(cx + 0, cy + 1));
- ar.push(new Array(cx + 1, cy + 1));
- ar.push(new Array(cx + 2, cy + 1));
- ar.push(new Array(cx + 0, cy + 2));
- ar.push(new Array(cx + 1, cy + 2));
- ar.push(new Array(cx + 2, cy + 2));
- //standard 4 tiles block (inner corners)
- ar.push(new Array(cx + 3, cy + 1));
- ar.push(new Array(cx + 4, cy + 1));
- ar.push(new Array(cx + 3, cy + 2));
- ar.push(new Array(cx + 4, cy + 2));
- return Java.to(ar, "int[][]");
- }
- //Function invoked when the editor wants to request an update using the logic
- //Each parameters are booleans and represent:
- //up, down, left, right, up-left, up-right, down-left, down-right
- //A boolean that is set to true means that the neighbor in that direction is of the same type
- function getTile(u, d, l, r, ul, ur, dl, dr) {
- var pos = [cx, cy];
- if (!u) {
- if (!l) pos = [cx, cy];
- else if (!r) pos = [cx + 2, cy];
- else pos = [cx + 1, cy + (dl ? 0 : ul ? 2 : 0)];
- } else if (!d) {
- if (!l) pos = [cx, cy + 2];
- else if (!r) pos = [cx + 2, cy + 2];
- else pos = [cx + 1, cy + 2];
- } else if (u) {
- if (!l) pos = [cx, cy + 1];
- else if (!r) pos = [cx + 2, cy + 1];
- }
- if (u && d && l && r) {
- if (!ul) pos = [cx + 3, cy + 1];
- else if (!ur) pos = [cx + 4, cy + 1];
- else if (!dl) pos = [cx + 3, cy + 2];
- else if (!dr) pos = [cx + 4, cy + 2];
- }
- if (u && d && l && r && ul && ur && dl && dr)
- pos = [cx + 1, cy + 1];
- return Java.to(pos, "int[]");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement