MCPcopy Create free account
hub / github.com/TanTanDev/rusty_demon_attack / draw_state_normal

Method draw_state_normal

src/enemy.rs:450–487  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

448 }
449
450 fn draw_state_normal(&self) {
451 let rand_frame = (self.state_shared.animation_timer / ENEMY_ANIM_TIME_FLAP).floor();
452 // Left wing
453 draw_texture_ex(
454 self.state_shared.texture,
455 self.state_shared.pos.x - ((self.state_shared.texture.width() / 4.0f32) * 1.0f32),
456 self.state_shared.pos.y,
457 WHITE,
458 DrawTextureParams {
459 rotation: 0f32,
460 source: Some(Rect::new(
461 self.state_shared.texture.width() / 4f32 * rand_frame as f32,
462 0f32,
463 self.state_shared.texture.width() / 4f32,
464 self.state_shared.texture.height(),
465 )),
466 ..Default::default()
467 },
468 );
469 // right wing
470 draw_texture_ex(
471 self.state_shared.texture,
472 self.state_shared.pos.x,
473 self.state_shared.pos.y,
474 WHITE,
475 DrawTextureParams {
476 rotation: 0f32,
477 flip_x: true,
478 source: Some(Rect::new(
479 self.state_shared.texture.width() / 4f32 * rand_frame as f32,
480 0f32,
481 self.state_shared.texture.width() / 4f32,
482 self.state_shared.texture.height(),
483 )),
484 ..Default::default()
485 },
486 );
487 }
488
489 pub fn draw(&mut self) {
490 match &self.state {

Callers 1

drawMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected