# HG changeset patch # User Matti Hamalainen # Date 1296339995 -7200 # Node ID b89ecc8d555731679cf55667a0525d645795557a # Parent 4bacc98973f568562e2972f9280a09947eaaefd9 More work. diff -r 4bacc98973f5 -r b89ecc8d5557 game/Engine.java --- a/game/Engine.java Sat Jan 29 01:54:28 2011 +0200 +++ b/game/Engine.java Sun Jan 30 00:26:35 2011 +0200 @@ -80,8 +80,6 @@ Piece current; public boolean flagGameOver; - - int moveX, moveY, movePoint; public GameBoard() diff -r 4bacc98973f5 -r b89ecc8d5557 game/Piece.java --- a/game/Piece.java Sat Jan 29 01:54:28 2011 +0200 +++ b/game/Piece.java Sun Jan 30 00:26:35 2011 +0200 @@ -89,9 +89,8 @@ if (type != PieceType.LOCKED && type != PieceType.ACTIVE) return; - currRotation = currRotation + (dir ? -1 : 1); - newAngle = (float) (currRotation * Math.PI) / 2.0f; - + currRotation = (currRotation + (dir ? -1 : 1)) % 4; + newAngle = (float) ((currRotation * Math.PI) / 2.0f); lerpRotation = new Interpolate(currAngle, newAngle, maxTime); rotationChanged = true; } @@ -134,8 +133,8 @@ if (rotationActive) { - float t = (time - rotationTime); - + float t = (time - rotationTime) / 2; + if (t < maxTime) currAngle = lerpRotation.getValue(t); else @@ -165,9 +164,12 @@ public void paint(Graphics2D g, float x, float y, float dim) { - AffineTransform tf = new AffineTransform(); - tf.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); - g.transform(tf); +// AffineTransform tf = new AffineTransform(); + g.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); +// g.transform(tf); + + if (type == PieceType.ACTIVE) + System.out.print("angle = " + currAngle + "\n"); switch (type) { case LOCKED: g.setPaint(Color.green); break; @@ -186,9 +188,12 @@ if (type == PieceType.ACTIVE) { + float offs1 = throb * 10.0f, + offs2 = throb * 20.0f; + g.setPaint(new Color(0.0f, 0.0f, 0.0f, (float) (1.0f - throb) )); g.setStroke(new BasicStroke(2.0f + throb * 2.0f)); - g.draw(new RoundRectangle2D.Float(x - throb * 10.0f, y - throb * 10.0f, dim + throb * 20.0f, dim + throb * 20.0f, dim / 10, dim / 10)); + g.draw(new RoundRectangle2D.Float(x - offs1, y - offs1, dim + offs2, dim + offs2, dim / 10, dim / 10)); } g.setPaint(Color.black);