Browse Source

🐛 Fix Obejct2D's rotationDegrees property, that was beeing interpreted as radians instead

Pedro Schneider 2 years ago
parent
commit
731463f2de

File diff suppressed because it is too large
+ 1 - 1
pandora.min.js


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

@@ -149,7 +149,7 @@ class Area2D extends Object2D
 
         db.push();
         db.translate(this.position.x, this.position.y);
-        db.rotate(this.rotationDegrees);
+        db.rotate(this.rotationDegrees / 180 * PI);
         db.scale(this.scale.x, this.scale.y);
 
         if (this.drawDebug)

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

@@ -173,7 +173,7 @@ class Object2D extends GameObject
 
         db.push();
         db.translate(this.position.x, this.position.y);
-        db.rotate(this.rotationDegrees);
+        db.rotate(this.rotationDegrees / 180 * PI);
         db.scale(this.scale.x, this.scale.y);
 
         this._draw(delta, db);

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

@@ -62,7 +62,7 @@ class Sprite2D extends Object2D
     {
         db.push();
         db.translate(this.position.x, this.position.y);
-        db.rotate(this.rotationDegrees);
+        db.rotate(this.rotationDegrees / 180 * PI);
         db.scale(this.scale.x, this.scale.y);
 
         db.image(this.P5Image, 0, 0, this.P5Image.width, this.P5Image.height);

+ 1 - 1
src/sketch.js

@@ -33,7 +33,7 @@ GameHandler._setup = function()
     GameHandler.drawDebugBufferBounds(true);
     textFont(AssetHandler.getP5FontByName("Lato"));
 
-    test = new Area2D("myTest", SHAPES.ELLIPSE, new Ellipse(200, 400), true, true);
+    test = new Area2D("myTest", SHAPES.RECT, new Rect(200, 400), true, true);
     test2 = new TestObj("myDummy");
     test2.setPosition(600, 600);
     test2.addChild(test);