prosperon/scripts/camera2d.jso

29 lines
646 B
Plaintext

this.phys = physics.kinematic;
this.dir_view2world = function(dir) { return dir.scale(this.realzoom()); };
this.view2world = function(pos) { return cmd(137,pos); };
this.world2view = function(pos) { return cmd(136,pos); };
this.realzoom = function() { return cmd(135); };
this.right = function()
{
return this.pos.x + (Window.width/2);
}
this.left = function()
{
return this.pos.x - (Window.width/2);
}
this.mixin({
get zoom() {
var z = Game.native.y / Window.dimensions.y;
return cmd(135)/z;
},
set zoom(x) {
x = Math.clamp(x,0.1,10);
var z = Game.native.y / Window.dimensions.y;
z *= x;
cmd(62,z);
},
});