How come I keep geting the errors when I use the simple shooter sample?

Garrett Tiller 6 Reputation points
2024-10-01T20:26:45.3933333+00:00

Theres a problem with this code:

GameplayScreen.cpp

`// Create a sphere primitive to represent the player.`
`    // The sphere will be used to handle collisions and constrain the player in the world.`

`    // It is not rendered so it is not added to the list of render objects.`

`    // It is added to the object list so it will be included in intersection calculations.`

`    m_player = ref new Player(XMFLOAT3(0.0f, -1.3f, 4.0f), 0.2f);`

`    m_objects.push_back(m_player);`

`    m_player->Active(true);`

`    m_camera = ref new Camera;`

`    m_camera->SetProjParams(XM_PI / 2, 1.0f, 0.01f, 100.0f);`

`    m_camera->SetViewParams(`

`        XMFLOAT3 m_player->Position(),            // Eye point in world coordinates.`

`        XMFLOAT3(0.0f, 0.7f, 0.0f),     // Look at point in world coordinates.`

`        XMFLOAT3(0.0f, 1.0f, 0.0f)      // The Up vector for the camera.`


```Then i keep geting these errors

Severity	Code	Description	Project	File	Line	Suppression State	Details

Error (active)	E0289	no instance of constructor "Player::Player" matches the argument list	

Error (active)	E0135	class "Player" has no member "Active"	

Error (active)	E1767	function "Camera::SetViewParams" cannot be called with the given argument list	

Error (active)	E0254	type name is not allowed	

Error (active)	E0018	expected a ')'

Universal Windows Platform (UWP)
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,105 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 17,816 Reputation points Microsoft Vendor
    2024-10-02T04:51:10.2566667+00:00

    Hi @Garrett Tiller ,

    Welcome to Microsoft Q&A!

    "no instance of constructor "Player::Player" matches the argument list",

    Sphere should be used instead of Player in the sample.

    m_player = ref new Sphere(XMFLOAT3(0.0f, -1.3f, 4.0f), 0.2f);
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly 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.


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.