Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: dart/samples/third_party/pop-pop-win/lib/src/canvas/game_element.dart

Issue 64033002: Version 0.8.10.8 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/samples/solar/web/solar.dart ('k') | dart/samples/third_party/pop-pop-win/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « dart/samples/solar/web/solar.dart ('k') | dart/samples/third_party/pop-pop-win/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698