mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 09:39:12 +08:00
Enable DCM rule double-literal-format. More details [here](https://dcm.dev/docs/rules/common/double-literal-format/). This both forbids trailing zeroes and mandates leading zeroes. If we would prefer a different style (e.g. prefer no leading zero instead), just lmk :)
25 lines
644 B
Dart
Executable File
25 lines
644 B
Dart
Executable File
import 'package:flame/components.dart';
|
|
import 'package:flame_isolate_example/terrain/terrain.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Grass extends PositionComponent with Terrain {
|
|
static final _color = Paint()..color = const Color(0xff567d46);
|
|
static final _debugColor = Paint()..color = Colors.black.withOpacity(0.5);
|
|
|
|
late final _rect = size.toRect();
|
|
late final _rect2 = Rect.fromCenter(
|
|
center: _rect.center,
|
|
height: 10,
|
|
width: 10,
|
|
);
|
|
|
|
@override
|
|
void render(Canvas canvas) {
|
|
canvas.drawRect(_rect, _color);
|
|
canvas.drawRect(_rect2, _debugColor);
|
|
}
|
|
|
|
@override
|
|
double difficulty = 1.0;
|
|
}
|