diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-27 00:26:35 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-27 00:26:35 -0700 |
| commit | 6fcf3b4e085ab8009ff1b0fd34e3f0ff8765465b (patch) | |
| tree | 38e451957e95f3063332883e37a05d31e80e245b /src/content/entities/entity_tnt.rs | |
| parent | a272aa9d9b2c642871abe2dc3379e6ffcce8bf56 (diff) | |
chair, performance improvement
Diffstat (limited to 'src/content/entities/entity_tnt.rs')
| -rw-r--r-- | src/content/entities/entity_tnt.rs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/content/entities/entity_tnt.rs b/src/content/entities/entity_tnt.rs index 2e4cef5..595ebd4 100644 --- a/src/content/entities/entity_tnt.rs +++ b/src/content/entities/entity_tnt.rs @@ -1,12 +1,9 @@ -use glam::{IVec2, Vec2}; +use glam::Vec2; -use crate::{ - sim::{ - entity::{EntityBehaviour, EntityCells, EntityDef, EntityUpdateCtx}, - lib::force::apply_explosion, - sim_manager::SimCtx, - }, - sprite_loader::load_sprite_to_cells, +use crate::sim::{ + entity::{EntityBehaviour, EntityDef, EntityUpdateCtx}, + lib::force::apply_explosion, + sim_manager::SimCtx, }; struct TntEntityBehaviour { @@ -30,15 +27,9 @@ impl EntityBehaviour for TntEntityBehaviour { } pub fn entity_tnt_def(position: Vec2) -> EntityDef { - let sprite_cells = load_sprite_to_cells("assets/sprites/tnt"); - let entity_cells = EntityCells { - cells: sprite_cells.cells, - size: IVec2::new(sprite_cells.width as i32, sprite_cells.height as i32), - }; - - EntityDef::from_cells( + EntityDef::from_sprite( position, - entity_cells, + "assets/sprites/tnt", Some(Box::new(TntEntityBehaviour { fuse: 3.0 })), ) } |
