Re-added the sprite screen. Made some adjustments to enemy AI.
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -18,16 +18,24 @@ class SpriteGallery extends StatelessWidget {
|
||||
backgroundColor: Colors.black,
|
||||
body: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 8, // 8 sprites per row
|
||||
crossAxisCount: 8,
|
||||
),
|
||||
itemCount: sprites.length,
|
||||
itemBuilder: (context, index) {
|
||||
// --- Check which enemy owns this sprite ---
|
||||
String label = "Idx: $index";
|
||||
String label = "Sprite Index: $index";
|
||||
for (final enemy in EnemyType.values) {
|
||||
if (enemy.claimsSpriteIndex(index)) {
|
||||
final EnemyAnimation? animation = enemy.getAnimationFromSprite(
|
||||
index,
|
||||
);
|
||||
// Appends the enum name (e.g., "guard", "dog")
|
||||
label += "\n${enemy.name}";
|
||||
|
||||
// Appends the animation name
|
||||
if (animation != null) {
|
||||
label += "\n${animation.name}";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user