Mercurial > hg > ristipolku
comparison game/Piece.java @ 10:4bacc98973f5
More work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 29 Jan 2011 01:54:28 +0200 |
parents | a7751971c2a3 |
children | b89ecc8d5557 |
comparison
equal
deleted
inserted
replaced
9:a7751971c2a3 | 10:4bacc98973f5 |
---|---|
90 return; | 90 return; |
91 | 91 |
92 currRotation = currRotation + (dir ? -1 : 1); | 92 currRotation = currRotation + (dir ? -1 : 1); |
93 newAngle = (float) (currRotation * Math.PI) / 2.0f; | 93 newAngle = (float) (currRotation * Math.PI) / 2.0f; |
94 | 94 |
95 lerpRotation = new Interpolate(currAngle, newAngle, maxTime); | |
95 rotationChanged = true; | 96 rotationChanged = true; |
96 lerpRotation = new Interpolate(currAngle, newAngle, maxTime); | |
97 } | 97 } |
98 | 98 |
99 public Point2D getPointCoords(float x, float y, float dim, int index) | 99 public Point2D getPointCoords(float x, float y, float dim, int index) |
100 { | 100 { |
101 float ox = 0, oy = 0; | 101 float ox = 0, oy = 0; |
156 { | 156 { |
157 } | 157 } |
158 | 158 |
159 if (activeChanged) | 159 if (activeChanged) |
160 { | 160 { |
161 | |
162 } | 161 } |
163 | 162 |
164 throb = (time % 100) / 100.0f; | 163 throb = (time % 100) / 100.0f; |
165 } | 164 } |
166 | 165 |
167 public void paint(Graphics2D g, float x, float y, float dim) | 166 public void paint(Graphics2D g, float x, float y, float dim) |
168 { | 167 { |
169 AffineTransform tf = new AffineTransform(); | 168 AffineTransform tf = new AffineTransform(); |
170 tf.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); | 169 tf.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); |
171 g.transform(tf); | 170 g.transform(tf); |
172 | |
173 if (type == PieceType.ACTIVE) | |
174 System.out.print("angle = " + currAngle + "\n"); | |
175 | 171 |
176 switch (type) { | 172 switch (type) { |
177 case LOCKED: g.setPaint(Color.green); break; | 173 case LOCKED: g.setPaint(Color.green); break; |
178 case ACTIVE: g.setPaint(Color.red); break; | 174 case ACTIVE: g.setPaint(Color.red); break; |
179 case START: g.setPaint(Color.orange); break; | 175 case START: g.setPaint(Color.orange); break; |