added pufferfish mob
This commit is contained in:
parent
3da8bb06ed
commit
cf64fb4851
@ -40,5 +40,14 @@
|
|||||||
"rotation": 0
|
"rotation": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"pufferfish": [
|
||||||
|
{
|
||||||
|
"position" : {
|
||||||
|
"x": 400,
|
||||||
|
"y": 150
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
pub mod base;
|
pub mod base;
|
||||||
pub mod jellyfish;
|
pub mod jellyfish;
|
||||||
pub mod octopus;
|
pub mod octopus;
|
||||||
pub mod whirlpool;
|
pub mod whirlpool;
|
||||||
|
pub mod pufferfish;
|
33
src/entities/enemy/pufferfish.rs
Normal file
33
src/entities/enemy/pufferfish.rs
Normal file
@ -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<RaylibDrawHandle>,
|
||||||
|
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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
src/world.rs
10
src/world.rs
@ -4,14 +4,7 @@ use failure::Error;
|
|||||||
use raylib::math::{Rectangle, Vector2};
|
use raylib::math::{Rectangle, Vector2};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{entities::{enemy::{jellyfish::JellyFish, octopus::Octopus, pufferfish::Pufferfish, whirlpool::Whirlpool}, fish::FishEntity}, player::Player};
|
||||||
entities::{
|
|
||||||
enemy::{jellyfish::JellyFish, octopus::Octopus, whirlpool::Whirlpool,},
|
|
||||||
fish::FishEntity,
|
|
||||||
|
|
||||||
},
|
|
||||||
player::Player,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct World {
|
pub struct World {
|
||||||
@ -31,6 +24,7 @@ pub struct World {
|
|||||||
pub jellyfish: Vec<JellyFish>,
|
pub jellyfish: Vec<JellyFish>,
|
||||||
pub octopus: Vec<Octopus>,
|
pub octopus: Vec<Octopus>,
|
||||||
pub whirlpool: Vec<Whirlpool>,
|
pub whirlpool: Vec<Whirlpool>,
|
||||||
|
pub pufferfish: Vec<Pufferfish>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user