diff --git a/src/projectile.rs b/src/projectile.rs index c2c4290..8cb6b4b 100644 --- a/src/projectile.rs +++ b/src/projectile.rs @@ -14,6 +14,9 @@ pub struct Projectile { despawn_countdown: Timer, } +#[derive(Resource)] +pub struct ProjectileSprite(Handle); + pub struct ProjectilePlugin; impl Projectile { @@ -28,10 +31,15 @@ impl Projectile { impl Plugin for ProjectilePlugin { fn build(&self, app: &mut App) { - app.add_systems(FixedPreUpdate, projectile_despawn_countdown); + app.add_systems(Startup, projectile_startup) + .add_systems(FixedPreUpdate, projectile_despawn_countdown); } } +pub fn projectile_startup(mut commands: Commands, asset_server: Res) { + commands.insert_resource(ProjectileSprite(asset_server.load("projectile.png"))); +} + pub fn projectile_despawn_countdown( mut commands: Commands, time: Res