mirror of
https://github.com/wassname/rl_2d_walker.js.git
synced 2026-09-09 11:33:20 +08:00
fix y zoom
This commit is contained in:
+3
-4
@@ -33,8 +33,9 @@ class Renderer {
|
||||
var minmax = this.getMinMaxDistance();
|
||||
this.target_zoom = Math.min(this.config.max_zoom_factor, this.getZoom(minmax.min_x, minmax.max_x + 4, minmax.min_y + 2, minmax.max_y + 2.5));
|
||||
this.zoom += 0.1 * (this.target_zoom - this.zoom);
|
||||
this.translate_x += 0.1 * (1.5 - minmax.min_x - this.translate_x);
|
||||
this.translate_y += 0.3 * (minmax.min_y * this.zoom + 280 - this.translate_y);
|
||||
this.translate_x += 0.1 * ((1.5 - minmax.min_x) - this.translate_x);
|
||||
this.translate_y += 0.3 * ((minmax.max_y + 1.5) * this.zoom - this.translate_y);
|
||||
console.log(this.translate_y)
|
||||
this.ctx.translate(this.translate_x * this.zoom, this.translate_y);
|
||||
this.ctx.scale(this.zoom, -this.zoom);
|
||||
|
||||
@@ -87,8 +88,6 @@ class Renderer {
|
||||
this.ctx.lineWidth = 1 / this.zoom;
|
||||
|
||||
// left legs and arms first
|
||||
|
||||
|
||||
this.ctx.lineWidth = walker.left_leg.frictionJoint.maxForce ? 4 / this.zoom : 1 / this.zoom;
|
||||
this.drawRect(walker.left_leg.foot);
|
||||
this.ctx.lineWidth = 1 / this.zoom;
|
||||
|
||||
Reference in New Issue
Block a user