@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user