diff game/Piece.java @ 152:64b04c0eccce

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Feb 2013 10:24:47 +0200
parents d6d92845d6a2
children 71205451ef57
line wrap: on
line diff
--- a/game/Piece.java	Wed Feb 06 10:23:28 2013 +0200
+++ b/game/Piece.java	Wed Feb 06 10:24:47 2013 +0200
@@ -239,6 +239,7 @@
             else
             {
                 currAngle = lerpRotation.start;
+                currScale = 1;
                 rotationActive = false;
             }
 
@@ -257,10 +258,16 @@
             float t = (time - typeTime) * 2.0f;
 
             if (t < maxTime)
+            {
                 typeValue = lerpType.getValue(t);
+                if (!rotationActive)
+                    currScale = (float) (1.0 + Math.sin(lerpScale.getValue(t)) * 0.1);
+            }
             else
             {
                 typeValue = lerpType.start;
+                if (!rotationActive)
+                    currScale = 1;
                 typeActive = false;
             }
 
@@ -280,8 +287,6 @@
         AffineTransform save = g.getTransform();
         Composite csave = g.getComposite();
 
-        // Scale dimensions
-        dim = dim * currScale;
 
         // Change compositing alpha for the whole piece drawing
         // when the piece is being "introduced".
@@ -294,6 +299,9 @@
         // Transform drawing by current angle
         g.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f);
 
+        // Scale dimensions
+        dim = dim * currScale;
+
         // Color piece by type
         switch (type) {
             case LOCKED:  g.setPaint(new Color(0.3f, 0.8f, 0.3f, 0.35f)); break;