diff --git a/lib/features/player/player.dart b/lib/features/player/player.dart index acecf23..a5af355 100644 --- a/lib/features/player/player.dart +++ b/lib/features/player/player.dart @@ -2,10 +2,10 @@ import 'dart:math' as math; import 'package:wolf_dart/classes/linear_coordinates.dart'; import 'package:wolf_dart/features/entities/collectible.dart'; -import 'package:wolf_dart/features/player/weapon.dart'; -import 'package:wolf_dart/features/player/weapons/knife.dart'; -import 'package:wolf_dart/features/player/weapons/machine_gun.dart'; -import 'package:wolf_dart/features/player/weapons/pistol.dart'; +import 'package:wolf_dart/features/weapon/weapons/knife.dart'; +import 'package:wolf_dart/features/weapon/weapons/machine_gun.dart'; +import 'package:wolf_dart/features/weapon/weapons/pistol.dart'; +import 'package:wolf_dart/features/weapon/weapons/weapon.dart'; class Player { // Spatial diff --git a/lib/features/renderer/weapon_painter.dart b/lib/features/renderer/weapon_painter.dart index 8cf204c..ad072f2 100644 --- a/lib/features/renderer/weapon_painter.dart +++ b/lib/features/renderer/weapon_painter.dart @@ -4,8 +4,8 @@ import 'package:wolf_dart/features/renderer/color_palette.dart'; class WeaponPainter extends CustomPainter { final List> sprite; - // 1. Initialize a reusable Paint object and disable anti-aliasing - // to keep the pixels perfectly sharp and chunky. + // Initialize a reusable Paint object and disable anti-aliasing to keep the + // pixels perfectly sharp and chunky. final Paint _paint = Paint() ..isAntiAlias = false ..style = PaintingStyle.fill; @@ -14,7 +14,8 @@ class WeaponPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - // Calculate width and height separately in case the container isn't a perfect square + // Calculate width and height separately in case the container isn't a + // perfect square double pixelWidth = size.width / 64; double pixelHeight = size.height / 64; @@ -30,8 +31,8 @@ class WeaponPainter extends CustomPainter { Rect.fromLTWH( x * pixelWidth, y * pixelHeight, - pixelWidth + - 0.5, // 2. Add a tiny 0.5 overlap to completely eliminate visual seams + // Add a tiny 0.5 overlap to completely eliminate visual seams + pixelWidth + 0.5, pixelHeight + 0.5, ), _paint, @@ -43,7 +44,7 @@ class WeaponPainter extends CustomPainter { @override bool shouldRepaint(covariant WeaponPainter oldDelegate) { - // 3. ONLY repaint if the actual animation frame (sprite) has changed! + // ONLY repaint if the actual animation frame (sprite) has changed! // This saves massive amounts of CPU when the player is just walking around. return oldDelegate.sprite != sprite; } diff --git a/lib/features/player/weapons/knife.dart b/lib/features/weapon/weapons/knife.dart similarity index 87% rename from lib/features/player/weapons/knife.dart rename to lib/features/weapon/weapons/knife.dart index 5255947..bf9bcae 100644 --- a/lib/features/player/weapons/knife.dart +++ b/lib/features/weapon/weapons/knife.dart @@ -1,4 +1,4 @@ -import 'package:wolf_dart/features/player/weapon.dart'; +import 'package:wolf_dart/features/weapon/weapons/weapon.dart'; class Knife extends Weapon { Knife() diff --git a/lib/features/player/weapons/machine_gun.dart b/lib/features/weapon/weapons/machine_gun.dart similarity index 60% rename from lib/features/player/weapons/machine_gun.dart rename to lib/features/weapon/weapons/machine_gun.dart index aad9f50..dfcbf4e 100644 --- a/lib/features/player/weapons/machine_gun.dart +++ b/lib/features/weapon/weapons/machine_gun.dart @@ -1,11 +1,11 @@ -import 'package:wolf_dart/features/player/weapon.dart'; +import 'package:wolf_dart/features/weapon/weapons/weapon.dart'; class MachineGun extends Weapon { MachineGun() : super( name: "Machine Gun", idleSprite: 413, - fireFrames: [414, 415], // Faster 2-frame loop + fireFrames: [414, 415], damage: 20, msPerFrame: 80, ); diff --git a/lib/features/player/weapons/pistol.dart b/lib/features/weapon/weapons/pistol.dart similarity index 73% rename from lib/features/player/weapons/pistol.dart rename to lib/features/weapon/weapons/pistol.dart index 1a910cd..3d77ead 100644 --- a/lib/features/player/weapons/pistol.dart +++ b/lib/features/weapon/weapons/pistol.dart @@ -1,4 +1,4 @@ -import 'package:wolf_dart/features/player/weapon.dart'; +import 'package:wolf_dart/features/weapon/weapons/weapon.dart'; class Pistol extends Weapon { Pistol() diff --git a/lib/features/player/weapon.dart b/lib/features/weapon/weapons/weapon.dart similarity index 100% rename from lib/features/player/weapon.dart rename to lib/features/weapon/weapons/weapon.dart