Enemies drop ammo now

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-14 15:51:23 +01:00
parent 001c7c3131
commit dfc6a94e88
3 changed files with 30 additions and 9 deletions

View File

@@ -337,11 +337,23 @@ class _WolfRendererState extends State<WolfRenderer>
entity.y += intent.movement.y;
// 4. Handle Item Drops & Score (Matches KillActor in C code)
// Check if they just died this exact frame
if (entity.state == EntityState.dead &&
entity.isDying &&
!entity.hasDroppedItem) {
entity.hasDroppedItem = true; // Make sure we only drop once!
entity.hasDroppedItem = true;
// Map ID 44 is usually the Ammo Clip in the Object Grid/Registry
Entity? droppedAmmo = EntityRegistry.spawn(
49, // The ID for an ammo clip collectible
entity.x,
entity.y,
widget.difficulty.level,
gameMap.sprites.length,
);
if (droppedAmmo != null) {
itemsToAdd.add(droppedAmmo);
}
// You will need to add a `bool hasDroppedItem = false;` to your base Enemy class.