(state_shared: &EnemyStateShared, state_data: &EnemyStateSpawning)
| 398 | } |
| 399 | |
| 400 | fn draw_state_spawning_mini(state_shared: &EnemyStateShared, state_data: &EnemyStateSpawning) { |
| 401 | let rand_frame = rand::gen_range(0i32, 2i32); |
| 402 | let fraction = state_data.spawn_timer / ENEMY_MINI_ANIM_TIME_SPAWN; |
| 403 | let sprite_width = state_shared.texture.width() / 4f32; |
| 404 | let scale = sprite_width * 0.5f32 + fraction * 1.5f32 * sprite_width; |
| 405 | draw_texture_ex( |
| 406 | state_shared.texture, |
| 407 | state_shared.pos.x - ((state_shared.texture.width() / 4.0f32) * 1.0f32), |
| 408 | state_shared.pos.y, |
| 409 | WHITE, |
| 410 | DrawTextureParams { |
| 411 | rotation: fraction * std::f32::consts::PI * 2f32, |
| 412 | dest_size: Some(vec2(scale, scale)), |
| 413 | source: Some(Rect::new( |
| 414 | state_shared.texture.width() / 4f32 * rand_frame as f32, |
| 415 | 0f32, |
| 416 | state_shared.texture.width() / 4f32, |
| 417 | state_shared.texture.height(), |
| 418 | )), |
| 419 | ..Default::default() |
| 420 | }, |
| 421 | ); |
| 422 | // right wing |
| 423 | draw_texture_ex( |
| 424 | state_shared.texture, |
| 425 | state_shared.pos.x, |
| 426 | state_shared.pos.y, |
| 427 | WHITE, |
| 428 | DrawTextureParams { |
| 429 | rotation: fraction * std::f32::consts::PI * 2f32, |
| 430 | flip_x: true, |
| 431 | dest_size: Some(vec2(scale, scale)), |
| 432 | source: Some(Rect::new( |
| 433 | state_shared.texture.width() / 4f32 * rand_frame as f32, |
| 434 | 0f32, |
| 435 | state_shared.texture.width() / 4f32, |
| 436 | state_shared.texture.height(), |
| 437 | )), |
| 438 | ..Default::default() |
| 439 | }, |
| 440 | ); |
| 441 | } |
| 442 | |
| 443 | fn draw_state_spawning(state_shared: &EnemyStateShared, state_data: &EnemyStateSpawning) { |
| 444 | match state_shared.enemy_type { |
nothing calls this directly
no outgoing calls
no test coverage detected