scale rendering

This commit is contained in:
Asraelite 2016-03-22 15:41:11 +00:00
parent 80bd84230d
commit 0ceea5f4af
7 changed files with 70 additions and 17 deletions

View file

@ -1,8 +1,27 @@
var SCALE = 32;
function World() {
this.bodies = {};
this.playerShip = false;
this.playerShipId = false;
this.getCenter = function() {
if (!this.playerShip) return { x: 0, y: 0 };
var x = this.playerShip.getPos().x;
var y = this.playerShip.getPos().y;
var comx = this.playerShip.com.x;
var comy = this.playerShip.com.y;
var r = this.playerShip.r;
var d = Math.sqrt(comx * comx + comy * comy);
var a = Math.atan2(comy, comx);
x += Math.cos(a + r) * d;
y += Math.sin(a + r) * d;
return { x: x, y: y };
}
this.clear = function() {
this.bodies = {};
this.playerShip = false;