Projects‎ > ‎

Phantom of the Knight


Phantom of the Knight was developed along-side Showdown in Ghost Town. So we were essentially writing two games at once. These are simple games for children with lots of animation and things to click on. The player's goal is to solve a mystery by finding and gathering clues. I rewrote the base engine to be C++ instead of C. I also rewrote all the tools in MFC.






bool CDrawbridgeRoom::OnCreateObject(TE_START * info)
{
    CString object_name = info->ObjectName;

    if ( object_name == "OBJ_P01_DRAWBRIDGE_P1" ||
         object_name == "OBJ_P01_DRAWBRIDGE_P2" ||
         object_name == "OBJ_P01_DRAWBRIDGE_P3" ||
         object_name == "OBJ_P01_DRAWBRIDGE_P4" )
    {
        UL location = object_name[object_name.GetLength() - 1] - '1';
        
        CDrawbridgeFlag * flag = new CDrawbridgeFlag((CDrawbridgeFlag::FlagStates)m_Banner_States[location],location + 1,info->ObjectName,info->AnimName,The_Game->GetBackgroundLayer(0),0);
        flag->SetPos(info->Pos.X,info->Pos.Y);
        flag->SetState((CDrawbridgeFlag::FlagStates)m_Flag_States[location]);

        if ( m_Puzzle_Done == false )
            flag->Enable();
        else
            flag->Disable();

        m_Flags[location] = flag;

        return true;
    }
    else if ( object_name == "OBJ_P01_DRAWBRIDGE_SP1" ||
              object_name == "OBJ_P01_DRAWBRIDGE_SP2" ||
              object_name == "OBJ_P01_DRAWBRIDGE_SP3" ||
              object_name == "OBJ_P01_DRAWBRIDGE_SP4" )
    {
        UL location = object_name[object_name.GetLength() - 1] - '1';
        
        Game::CAnimatedEntity * object = new Game::CAnimatedEntity(info->ObjectName,info->AnimName,The_Game->GetBackgroundLayer(0),0);
        object->SetPos(info->Pos.X,info->Pos.Y);

        m_Banners[location] = object;

        CString anim;
        anim.Format("ANIM_P01_DRAWBRIDGE_SP%iF%i",location + 1,m_Banner_States[location]);

        object->SetAnim(anim,Game::CAnimatedEntity::ForwardLoop,4,rand() % 4);

        return true;
    }
    else if ( object_name == "OBJ_P01_TO_P04" && m_Puzzle_Done == false )
        return true;    // don't create exit until puzzle is done
    else if ( object_name == "OBJ_P01_DRAWBRIDGE_DOOR" )
    {
        m_Drawbridge = new Game::CAnimatedEntity(info->ObjectName,info->AnimName,The_Game->GetBackgroundLayer(0),-1);
        m_Drawbridge->SetPos(info->Pos.X,info->Pos.Y);

        if ( m_Puzzle_Done )
            m_Drawbridge->SetAnimationType(Game::CAnimatedEntity::LastFrame);
        else
            m_Drawbridge->SetAnimationType(Game::CAnimatedEntity::NoAnimation);

        return true;
    }
    else if ( object_name == "OBJ_P01_DRAWBRIDGE_OVERLAY" )
    {
        Game::CAnimatedEntity * object = new Game::CAnimatedEntity(info->ObjectName,info->AnimName,The_Game->GetBackgroundLayer(0),0);
        object->SetPos(info->Pos.X,info->Pos.Y);

        return true;
    }

    return false;
}