1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-01-06 02:56:41 +00:00
This commit is contained in:
dawnDus 2022-02-26 23:54:04 -05:00
parent b29fe87e76
commit 287e06e24b
No known key found for this signature in database
GPG key ID: 972AABDE81848F21
3 changed files with 17 additions and 11 deletions

View file

@ -313,9 +313,9 @@ impl NPC {
npc.x = self.x;
npc.y = self.y;
let angle = f64::atan2((player.y - 0x1400 - self.y) as f64, (player.x - self.x) as f64);
npc.vel_x = (2048.0 * angle.cos()) as i32;
npc.vel_y = (2048.0 * angle.sin()) as i32;
let angle = f64::atan2((self.y - player.y) as f64, (self.x - player.x) as f64);
npc.vel_x = (-2048.0 * angle.cos()) as i32;
npc.vel_y = (-2048.0 * angle.sin()) as i32;
let _ = npc_list.spawn(0x100, npc);
@ -354,10 +354,12 @@ impl NPC {
let mut npc = NPC::create(277, &state.npc_table);
npc.cond.set_alive(true);
npc.x = self.x;
npc.y = self.y;
let angle = f64::atan2((player.y - 0x1400 - self.y) as f64, (player.x - self.x) as f64);
npc.vel_x = (2048.0 * angle.cos()) as i32;
npc.vel_y = (2048.0 * angle.sin()) as i32;
let angle = f64::atan2((self.y - player.y) as f64, (self.x - player.x) as f64);
npc.vel_x = (-2048.0 * angle.cos()) as i32;
npc.vel_y = (-2048.0 * angle.sin()) as i32;
let _ = npc_list.spawn(0x100, npc);
@ -437,7 +439,11 @@ impl NPC {
Ok(())
}
pub(crate) fn tick_n277_red_demon_projectile(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
pub(crate) fn tick_n277_red_demon_projectile(
&mut self,
state: &mut SharedGameState,
npc_list: &NPCList,
) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
}
@ -446,7 +452,7 @@ impl NPC {
self.x += self.vel_x;
self.y += self.vel_y;
if self.flags.any_flag() {
if self.flags.hit_anything() {
let mut npc = NPC::create(4, &state.npc_table);
npc.cond.set_alive(true);
npc.x = self.x;

View file

@ -1258,8 +1258,8 @@ impl NPC {
if self.x < 0
|| self.y < 0
|| self.x > (stage.map.width as i32 * state.tile_size.as_int())
|| self.y > (stage.map.height as i32 * state.tile_size.as_int())
|| self.x > (stage.map.width as i32 * state.tile_size.as_int() * 0x200)
|| self.y > (stage.map.height as i32 * state.tile_size.as_int() * 0x200)
{
self.vanish(state);
return Ok(());

View file

@ -33,7 +33,7 @@ impl BossNPC {
match self.parts[0].action_num {
0 => {
self.hurt_sound[0] = 52;
self.parts[0].x = 6 * 0x2000;
self.parts[0].x = 6 * 0x2000 + state.constants.game.tile_offset_x * 0x2000;
self.parts[0].y = 12 * 0x2000;
self.parts[0].direction = Direction::Right;
self.parts[0].display_bounds = Rect {