diff --git a/lib/game/Game.dart b/lib/game/Game.dart index ff879fd..456ae38 100644 --- a/lib/game/Game.dart +++ b/lib/game/Game.dart @@ -21,11 +21,12 @@ class Game { } // In-World Logic Updates - void update([num dt]) { + void update([num speed]) { + print(speed); Point next = isRandom ? nextPosRandom() : nextPosOrdered(_curPos); if (_curPos.x < 0) _curPos = Point(0, _curPos.y); Color newColor = isRandom ? randomColor() : nextColor( - grid[_curPos.y][_curPos.x]); + grid[_curPos.y][_curPos.x], step: speed ?? 1); grid[next.y][next.x] = newColor; _curPos = next; } @@ -47,14 +48,14 @@ class Game { return new Color(rng.nextInt(max), rng.nextInt(max), rng.nextInt(max)); } - Color nextColor(Color col) { + Color nextColor(Color col, {int step = 1}) { if (col.r > 254 || col.g > 254 || col.b > 254) return randomColor(100); if (col.r > col.g && col.r > col.b) - return Color(col.r + 1, col.g, col.b); + return Color(col.r + step, col.g, col.b); else if (col.b > col.r && col.b > col.g) - return Color(col.r, col.g, col.b + 1); + return Color(col.r, col.g, col.b + step); else - return Color(col.r, col.g + 1, col.b); + return Color(col.r, col.g + step, col.b); } // Render Pipeline