How do i access my scripts?

Garrett Tiller 6 Reputation points
2023-01-13T01:21:10.98+00:00

I been having trouble with this code.

void GamePlay::LoadGame()
{
    m_PlayerOne->Position(XMFLOAT3(0.0f, -1.3f, 4.0f));
    m_PlayerTwo->Position(XMFLOAT3(0.0f, -1.3f, -4.0f));

    m_camera->SetViewParams(
        XMFLOAT3(0.0f, 0.0f, 0.0f),                                     // Eye point in world coordinates.
        m_PlayerOne->Position(position) + PlayerTwo->Position(position),       // Look at point in world coordinates.
        XMFLOAT3(0.0f, 1.0f, 0.0f)                                    // The Up vector for the camera.
    );

    
    m_currentLevel = 0;
    m_levelDuration = m_level[m_currentLevel]->m_round;
    m_gameActive = false;
    m_levelActive = false;
    m_timer->Reset();
}

This code

 m_PlayerOne->Position(position) + PlayerTwo->Position(position), 

has this error

"Player.h is inaccessible"

Developer technologies C++
{count} votes

2 answers

Sort by: Most helpful
  1. YujianYao-MSFT 4,296 Reputation points Microsoft External Staff
    2023-01-13T08:01:38.98+00:00

    Hi @Garrett Tiller ,

    m_PlayerOne->Position(position) + PlayerTwo->Position(position) This code doesn't look like it's going to cause an error, I suggest you check for any typos in the variable names.

    "Player.h is inaccessible" I suggest you check if you have added the header file path in project properties and then use #include to include it.

    enter image description here

    Best regards,

    Elya


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Garrett Tiller 6 Reputation points
    2023-01-14T19:02:42.1966667+00:00

    Another error just appeared

    E3362 expression must have arithmetic, unscoped enum, or pointer type but has type "void"


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.