ソースを参照

🐛 Fix wrong drawing position for sprites and shapes

Pedro Schneider 3 年 前
コミット
885e7e20a8

+ 2 - 2
pandora/game_objects/2d_objects/Shape2D.js

@@ -32,11 +32,11 @@ class Shape2D extends Object2D
         {
             case SHAPES.RECT:
                 rectMode(this.shapeMode);
-                rect(this.position.x, this.position.y, this.shape.w, this.shape.h);
+                rect(0, 0, this.shape.w, this.shape.h);
                 break;
             case SHAPES.ELLIPSE:
                 ellipseMode(this.shapeMode);
-                ellipse(this.position.x, this.position.y, this.shape.rx, this.shape.ry);
+                ellipse(0, 0, this.shape.rx, this.shape.ry);
         }
 
         this._draw(delta);

+ 1 - 1
pandora/game_objects/2d_objects/Sprite2D.js

@@ -14,7 +14,7 @@ class Sprite2D extends Object2D
         rotate(this.rotationDegrees);
         scale(this.scale.x, this.scale.y);
 
-        image(this.P5Image, this.position.x, this.position.y, this.P5Image.width, this.P5Image.height);
+        image(this.P5Image, 0, 0, this.P5Image.width, this.P5Image.height);
 
         this._draw(delta);