| OLD | NEW |
| 1 part of ppw_canvas; | 1 part of ppw_canvas; |
| 2 | 2 |
| 3 class GameElement extends ParentThing { | 3 class GameElement extends ParentThing { |
| 4 static const _edgeOffset = 32; | 4 static const _edgeOffset = 32; |
| 5 static const _backgroundSize = const Size(2048, 1536); | 5 static const _backgroundSize = const Size(2048, 1536); |
| 6 static const _backgroundEdgeOffset = 256; | 6 static const _backgroundEdgeOffset = 256; |
| 7 static const _backgroundHoleSize = 16 * SquareElement._size + 2 * _edgeOffset; | 7 static const _backgroundHoleSize = 16 * SquareElement._size + 2 * _edgeOffset; |
| 8 static const _boardOffset = const Vector(352, 96); | 8 static const _boardOffset = const Vector(352, 96); |
| 9 static const _popExplodeAnimationOffset = const Vector(-88, -88); | 9 static const _popExplodeAnimationOffset = const Vector(-88, -88); |
| 10 static const _popAnimationHitFrame = 12; | 10 static const _popAnimationHitFrame = 12; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 .where((t2) => t2.item2 == SquareState.bomb || t2.item2 == SquareState
.hidden) | 165 .where((t2) => t2.item2 == SquareState.bomb || t2.item2 == SquareState
.hidden) |
| 166 .map((t2) => t2.item1) | 166 .map((t2) => t2.item1) |
| 167 .toList(); | 167 .toList(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 final values = reveals.map((c) { | 170 final values = reveals.map((c) { |
| 171 final initialOffset = new Vector(SquareElement._size * c.x, | 171 final initialOffset = new Vector(SquareElement._size * c.x, |
| 172 SquareElement._size * c.y); | 172 SquareElement._size * c.y); |
| 173 final squareOffset = _popExplodeAnimationOffset + initialOffset; | 173 final squareOffset = _popExplodeAnimationOffset + initialOffset; |
| 174 | 174 |
| 175 var delay = _popAnimationHitFrame + ((c - start).length * 4).toInt(); | 175 var delay = _popAnimationHitFrame + ((c - start).magnitude * 4).toInt(); |
| 176 delay += rnd.nextInt(10); | 176 delay += rnd.nextInt(10); |
| 177 | 177 |
| 178 return [c, initialOffset, squareOffset, delay]; | 178 return [c, initialOffset, squareOffset, delay]; |
| 179 }).toList(); | 179 }).toList(); |
| 180 | 180 |
| 181 values.sort((a, b) { | 181 values.sort((a, b) { |
| 182 final int da = a[3]; | 182 final int da = a[3]; |
| 183 final int db = b[3]; | 183 final int db = b[3]; |
| 184 return da.compareTo(db); | 184 return da.compareTo(db); |
| 185 }); | 185 }); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 _scaledInnerBox = new Box(_backgroundEdgeOffset * _scale, 0, | 373 _scaledInnerBox = new Box(_backgroundEdgeOffset * _scale, 0, |
| 374 sizeX - 2 * _backgroundEdgeOffset * _scale, sizeY); | 374 sizeX - 2 * _backgroundEdgeOffset * _scale, sizeY); |
| 375 } | 375 } |
| 376 | 376 |
| 377 static num _getScale(int count, num fullSize, num holeSize) { | 377 static num _getScale(int count, num fullSize, num holeSize) { |
| 378 final k = count * SquareElement._size + 2 * _edgeOffset; | 378 final k = count * SquareElement._size + 2 * _edgeOffset; |
| 379 | 379 |
| 380 return k * fullSize / holeSize; | 380 return k * fullSize / holeSize; |
| 381 } | 381 } |
| 382 } | 382 } |
| OLD | NEW |