diff --git a/assets/worlds/mainworld.json b/assets/worlds/mainworld.json index 9c46d40..bceb923 100644 --- a/assets/worlds/mainworld.json +++ b/assets/worlds/mainworld.json @@ -40,5 +40,14 @@ "rotation": 0 } + ], + "pufferfish": [ + { + "position" : { + "x": 400, + "y": 150 + } + } + ] } \ No newline at end of file diff --git a/src/entities/enemy/mod.rs b/src/entities/enemy/mod.rs index 18acd78..91246eb 100644 --- a/src/entities/enemy/mod.rs +++ b/src/entities/enemy/mod.rs @@ -1,4 +1,5 @@ pub mod base; pub mod jellyfish; pub mod octopus; -pub mod whirlpool; \ No newline at end of file +pub mod whirlpool; +pub mod pufferfish; \ No newline at end of file diff --git a/src/entities/enemy/pufferfish.rs b/src/entities/enemy/pufferfish.rs new file mode 100644 index 0000000..57080b3 --- /dev/null +++ b/src/entities/enemy/pufferfish.rs @@ -0,0 +1,33 @@ +use raylib::prelude::*; + +use serde::{Deserialize, Serialize}; + +use super::base::EnemyBase; + + +#[derive(Debug, Serialize, Deserialize, Default, Clone)] +pub struct Pufferfish{ + pub position: Vector2, + +} + + +impl EnemyBase for Pufferfish{ + fn render( + &mut self, + context_2d: &mut RaylibMode2D, + player: &mut crate::player::Player, + resources: &mut crate::resources::GlobalResources, + dt: f64, + ) { + context_2d.draw_circle(self.position.x as i32, self.position.y as i32, 12.0, Color::RED); + } + + fn handle_logic(&mut self, player: &mut crate::player::Player, dt: f64) { + + } + + fn handle_getting_attacked(&mut self, stun_duration: f64, current_time: f64) { + + } +} \ No newline at end of file diff --git a/src/world.rs b/src/world.rs index e1e1e00..15f592b 100644 --- a/src/world.rs +++ b/src/world.rs @@ -4,14 +4,7 @@ use failure::Error; use raylib::math::{Rectangle, Vector2}; use serde::{Deserialize, Serialize}; -use crate::{ - entities::{ - enemy::{jellyfish::JellyFish, octopus::Octopus, whirlpool::Whirlpool,}, - fish::FishEntity, - - }, - player::Player, -}; +use crate::{entities::{enemy::{jellyfish::JellyFish, octopus::Octopus, pufferfish::Pufferfish, whirlpool::Whirlpool}, fish::FishEntity}, player::Player}; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct World { @@ -31,6 +24,7 @@ pub struct World { pub jellyfish: Vec, pub octopus: Vec, pub whirlpool: Vec, + pub pufferfish: Vec }