Skip to content

Commit

Permalink
Simple RCL rendering for controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
ricochet1k committed Apr 5, 2017
1 parent 783c137 commit ec6ec5d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/scripts/objects/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,31 @@ export default class Controller extends GameObject {

let g = this.g;

// console.log("controller", obj);

const m = S(5);
const A = Math.PI * 2 / 8;
const r1 = S(8);
const r2 = S(4);
const o = 0.0;


g.clear();

for (let i = 0; i < obj.level; i++) {
g.lineStyle(1, 0x000000, 1);
g.beginFill(0x00ddff);
const a = (-A/2 - Math.PI / 2) + A * i + o;
const b = a + A - 2*o;
g.moveTo(m+Math.cos(a)*r1, m+Math.sin(a)*r1);
g.lineTo(m+Math.cos(b)*r1, m+Math.sin(b)*r1);
g.lineTo(m+Math.cos(b)*r2, m+Math.sin(b)*r2);
g.lineTo(m+Math.cos(a)*r2, m+Math.sin(a)*r2);
g.closePath();
g.endFill();
}

g.lineStyle(2, 0xffffff, 1);
g.drawCircle(S(5), S(5), S(7));
g.drawCircle(m, m, r1);
}
}

0 comments on commit ec6ec5d

Please sign in to comment.