소스 검색

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

Pedro Schneider 3 년 전
부모
커밋
731463f2de
5개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      pandora.min.js
  2. 1 1
      pandora/game_objects/2d_objects/Area2D.js
  3. 1 1
      pandora/game_objects/2d_objects/Object2D.js
  4. 1 1
      pandora/game_objects/2d_objects/Sprite2D.js
  5. 1 1
      src/sketch.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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);