jelly movement
This commit is contained in:
parent
0aef4804fd
commit
9e0a8df259
@ -1,29 +1,36 @@
|
|||||||
use super::base::EnemyBase;
|
use super::base::EnemyBase;
|
||||||
|
use crate::{player::Player, resources::GlobalResources};
|
||||||
use raylib::prelude::*;
|
use raylib::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate::{player::Player, resources::GlobalResources};
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
pub struct JellyFish {
|
pub struct JellyFish {
|
||||||
pub position: Vector2,
|
pub position: Vector2,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub stunned_timer: f64
|
pub stunned_timer: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JellyFish {
|
impl JellyFish {}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EnemyBase for JellyFish {
|
impl EnemyBase for JellyFish {
|
||||||
fn render(&self, context_2d: &mut raylib::prelude::RaylibMode2D<raylib::prelude::RaylibDrawHandle>, resources: &mut GlobalResources) {
|
fn render(
|
||||||
|
&self,
|
||||||
|
context_2d: &mut raylib::prelude::RaylibMode2D<raylib::prelude::RaylibDrawHandle>,
|
||||||
|
resources: &mut GlobalResources,
|
||||||
|
) {
|
||||||
|
// Simple sine position
|
||||||
|
let v_trans = context_2d.get_time().sin();
|
||||||
|
|
||||||
// Render the jellyfish
|
// Render the jellyfish
|
||||||
resources.jellyfish_animation_regular.draw(context_2d, self.position, 0.0);
|
resources.jellyfish_animation_regular.draw(
|
||||||
|
context_2d,
|
||||||
// // TODO
|
Vector2 {
|
||||||
// context_2d.draw_circle_v(self.position, 5.0, Color::RED);
|
x: self.position.x,
|
||||||
|
y: self.position.y+ (2.0 * v_trans as f32),
|
||||||
|
},
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_logic(&mut self, player: &mut Player, dt: f64) {
|
fn handle_logic(&mut self, player: &mut Player, dt: f64) {
|
||||||
@ -33,4 +40,4 @@ impl EnemyBase for JellyFish {
|
|||||||
fn handle_getting_attacked(&mut self) {
|
fn handle_getting_attacked(&mut self) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user