Reorganized files

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-13 23:10:39 +01:00
parent 3086e5a8f4
commit a4bc6f8520
6 changed files with 15 additions and 14 deletions

View File

@@ -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

View File

@@ -4,8 +4,8 @@ import 'package:wolf_dart/features/renderer/color_palette.dart';
class WeaponPainter extends CustomPainter {
final List<List<int>> 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;
}

View File

@@ -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()

View File

@@ -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,
);

View File

@@ -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()