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:
2026-03-15 18:08:00 +01:00
parent 2892984e4e
commit 25c08dfe99
12 changed files with 163 additions and 117 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
import 'package:wolf_3d_flutter/wolf_3d.dart';
import 'package:wolf_dart/screens/difficulty_screen.dart';
import 'package:wolf_dart/screens/sprite_gallery.dart';
class EpisodeScreen extends StatefulWidget {
const EpisodeScreen({super.key});
@@ -31,7 +32,19 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
final List<Episode> episodes = Wolf3d.I.activeGame.episodes;
return Scaffold(
backgroundColor: Colors.black,
backgroundColor: Colors.teal,
floatingActionButton: IconButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return SpriteGallery(sprites: Wolf3d.I.sprites);
},
),
);
},
icon: Icon(Icons.bug_report),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

View File

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