void cBall :: Update( void ) { if( !m_valid_update ) { return; } // right if( m_velx > 0.0f ) { Set_Velocity(20,0); m_rot_z += pFramerate->m_speed_factor * 40; } // left else { Set_Velocity(-20,0); m_rot_z -= pFramerate->m_speed_factor * 40; } // if ball is out of Player Range if( !Is_In_Player_Range() ) { Destroy(); } // glim animation if( m_glim_mod ) { m_glim_counter += pFramerate->m_speed_factor * 0.1f; //m_glim_counter += pFramerate->m_speed_factor * 0.0f; if( m_glim_counter > 1.0f ) { m_glim_counter = 1.0f; //m_glim_counter = 0.0f; m_glim_mod = 0; } } else { m_glim_counter -= pFramerate->m_speed_factor * 0.1f; //m_glim_counter -= pFramerate->m_speed_factor * 0.0f; if( m_glim_counter < 0.0f ) { m_glim_counter = 0.0f; m_glim_mod = 1; } } // generate fire particle animation m_fire_counter += pFramerate->m_speed_factor; while( m_fire_counter > 1 ) { Generate_Particles(); m_fire_counter -= 1; } }
void cRokko :: Activate( void ) { pAudio->Play_Sound( "enemy/rokko/activate.wav" ); m_state = STA_FLY; m_massive_type = MASS_MASSIVE; Set_Active( 1 ); if( m_direction == DIR_LEFT ) { Set_Velocity( -m_speed, 0.0f ); } else if( m_direction == DIR_RIGHT ) { Set_Velocity( m_speed, 0.0f ); } else if( m_direction == DIR_UP ) { Set_Velocity( 0.0f, -m_speed ); } else if( m_direction == DIR_DOWN ) { Set_Velocity( 0.0f, m_speed ); } }
void cStaticEnemy :: Update( void ) { cEnemy::Update(); if( !m_valid_update || !Is_In_Player_Range() ) { return; } if( m_rotation_speed ) { // update rotation Add_Rotation_Z( m_rotation_speed * pFramerate->m_speed_factor ); } if( m_path_state.m_path ) { // move along path if( m_path_state.Path_Move( m_speed * pFramerate->m_speed_factor ) == 0 ) { if( !m_path_state.m_path->m_rewind ) { // if we can not move further along the path, reverse the direction m_path_state.Move_Toggle(); } } // get difference float diff_x = ( m_path_state.m_path->m_start_pos_x + m_path_state.pos_x ) - m_pos_x; float diff_y = ( m_path_state.m_path->m_start_pos_y + m_path_state.pos_y ) - m_pos_y; // move to position Set_Velocity( diff_x, diff_y ); } }
void cStaticEnemy::Update(void) { cEnemy::Update(); if (!m_valid_update || !Is_In_Player_Range()) { return; } if (m_rotation_speed) { Add_Rotation_Z(m_rotation_speed * pFramerate->m_speed_factor); } if (m_path_state.m_path) { if (m_path_state.Path_Move(m_speed * pFramerate->m_speed_factor) == 0) { if (!m_path_state.m_path->m_rewind) { m_path_state.Move_Toggle(); } } float diff_x = (m_path_state.m_path->m_start_pos_x + m_path_state.pos_x) - m_pos_x; float diff_y = (m_path_state.m_path->m_start_pos_y + m_path_state.pos_y) - m_pos_y; Set_Velocity(diff_x, diff_y); } }
void cFlyon::Set_Direction(const ObjectDirection dir) { // already set if (dir == m_direction) { return; } if (dir != DIR_UP && dir != DIR_DOWN && dir != DIR_LEFT && dir != DIR_RIGHT) { printf("Error : Unknown Flyon direction %d\n", m_direction); return; } cEnemy::Set_Direction(dir, 1); // clear Set_Rotation(0.0f, 0.0f, 0.0f, 1); if (m_start_direction == DIR_UP) { // default } else if (m_start_direction == DIR_LEFT) { Set_Rotation_Z(270.0f, 1); } else if (m_start_direction == DIR_RIGHT) { Set_Rotation_Z(90.0f, 1); } else if (m_start_direction == DIR_DOWN) { Set_Rotation_Z(180.0f, 1); } Set_Velocity(0.0f, 0.0f); Update_Dest_Vel(); }
void cBall :: Destroy_Ball( bool with_sound /* = 0 */ ) { Set_Velocity(0,0); if( with_sound ) { if( m_ball_type == FIREBALL_DEFAULT ) { pAudio->Play_Sound( "item/fireball_explode.wav" ); } } Destroy(); }
void cStaticEnemy :: Set_Path_Identifier( const std::string &path ) { m_path_state.Set_Path_Identifier( path ); Set_Velocity( 0.0f, 0.0f ); }