summaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/entities/entity_tnt.rs23
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 })),
)
}