new UI + new targets.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
/// The one scoring rule for a shot on the default target (assets/target.png,
|
||||
/// 1200x1200). Saving, the preview and the target view all use it, so a shot
|
||||
/// scores the same everywhere.
|
||||
/// The one scoring rule for a shot, in the 1200 × 1200 space every target
|
||||
/// design shares (target-designs/v3: centre 600/600, ring 1 at r 510, the
|
||||
/// black at r 180). Saving, the preview and the target view all use it, so a
|
||||
/// shot scores the same everywhere and on every design.
|
||||
///
|
||||
/// A shot counts for the best ring its edge touches: the distance from the
|
||||
/// centre to the bullet's centre, minus the bullet's radius, is compared with
|
||||
@@ -11,12 +12,31 @@ import 'dart:ui';
|
||||
class TargetScoring {
|
||||
TargetScoring._();
|
||||
|
||||
static const Offset center = Offset(601, 598);
|
||||
static const double size = 1200;
|
||||
static const Offset center = Offset(600, 600);
|
||||
static const double bulletRadius = 25;
|
||||
static const double bulletDiameter = 53; // drawn size of a hit
|
||||
|
||||
/// Outer edge of ring 10, 9, ... 1, measured from [center].
|
||||
///
|
||||
/// A shot touching a ring line counts the higher value, so each edge is the
|
||||
/// outer edge of its printed line: the line's centre radius plus half its
|
||||
/// width. Lines in the v3 designs: 5 px white at r 70 and 125 (rings 9, 8),
|
||||
/// 3 px on the paper at r 235 … 510 (rings 6 … 1). Ring 7 is the edge of
|
||||
/// the black and 10 the centre dot, with no line of their own.
|
||||
static const double _paperLine = 3;
|
||||
static const double _blackLine = 5;
|
||||
static const List<double> rings = [
|
||||
14, 70, 125, 180, 235, 290, 345, 400, 455, 510,
|
||||
15, // 10: centre dot
|
||||
70 + _blackLine / 2, // 9
|
||||
125 + _blackLine / 2, // 8
|
||||
180, // 7: edge of the black
|
||||
235 + _paperLine / 2, // 6
|
||||
290 + _paperLine / 2, // 5
|
||||
345 + _paperLine / 2, // 4
|
||||
400 + _paperLine / 2, // 3
|
||||
455 + _paperLine / 2, // 2
|
||||
510 + _paperLine / 2, // 1
|
||||
];
|
||||
|
||||
/// Score of a shot whose centre is at [bullet] (default target coordinates).
|
||||
|
||||
Reference in New Issue
Block a user