Share via

Problem with model classes

Garrett Tiller 31 Reputation points
2022-09-05T21:41:58.62+00:00

I spent three days fixing the code making Player.h and Enemy.h accessible by rewriting this

Player^ m_player;  
  
City^                          world;  
  
std::vector<Enemy^>            m_enemies;  

The problem is now I need the identifier for Player and City while Enemy need a >

#pragma once  
  
#include "pch.h"  
  
  
  
  
class Enemy  
{  
  
 Enemy(char* enem_model_path, char* enem_skin_path, char* weapon_model_path, char* weapon_skin_path);  
  
 void create();  
  
 void SetPosAndDir(Vector3 position, Vector3 direction);  
  
 void StepUpBullets();  
  
 void CreateDeviceDependentResources();  
  
 void Scale(Vector3 scale);  
  
 void StepDieTimer();  
  
 void Run();  
  
 void SetAnim(int i);  
  
 void Render();  
  
 virtual void fire();  
  
 void OnDeviceLost();  
  
 float angle;  
 float deltaAngle;  
 float deltaMove;  
  
 float speedOffset;  
 float health;  
  
 float     died_time;  
  
 DirectX::SimpleMath::Vector3 m_direction;  
  
 DirectX::SimpleMath::Vector3  m_position;  
  
 DirectX::SimpleMath::Vector3 m_scale;  
  
 DirectX::ModelBone::TransformArray m_drawBones;  
  
 DX::AnimationSDKMESH m_animation;  
  
 std::vector<Bullets*>         bullets;  
  
 float bulletSpeed;  
  
 AnimationState                 mAnimationState;  
  
  
};  
#pragma once  
  
#include "pch.h"  
  
  
  
  
class Enemy  
{  
  
 Enemy(char* enem_model_path, char* enem_skin_path, char* weapon_model_path, char* weapon_skin_path);  
  
 void create();  
  
 void SetPosAndDir(Vector3 position, Vector3 direction);  
  
 void StepUpBullets();  
  
 void CreateDeviceDependentResources();  
  
 void Scale(Vector3 scale);  
  
 void StepDieTimer();  
  
 void Run();  
  
 void SetAnim(int i);  
  
 void Render();  
  
 virtual void fire();  
  
 void OnDeviceLost();  
  
 float angle;  
 float deltaAngle;  
 float deltaMove;  
  
 float speedOffset;  
 float health;  
  
 float     died_time;  
  
 DirectX::SimpleMath::Vector3 m_direction;  
  
 DirectX::SimpleMath::Vector3  m_position;  
  
 DirectX::SimpleMath::Vector3 m_scale;  
  
 DirectX::ModelBone::TransformArray m_drawBones;  
  
 DX::AnimationSDKMESH m_animation;  
  
 std::vector<Bullets*>         bullets;  
  
 float bulletSpeed;  
  
 AnimationState                 mAnimationState;  
  
  
};  
  
#pragma once  
  
#include "pch.h"  
  
  
  
  
class Player  
{  
  
public:  
  
 Player(Vector3 position, Vector3 direction);  
  
 void CreateDeviceDependentResources();  
  
 void ApplyGravity();  
  
 void Render();  
  
 void OnDeviceLost();  
  
 float angle;  
 float deltaAngle;  
 float deltaMove;  
  
 float speedOffset;  
 float health;  
  
 DirectX::SimpleMath::Vector3 m_direction;  
  
 DirectX::SimpleMath::Vector3  m_position;  
  
 DirectX::ModelBone::TransformArray m_drawBones;  
  
 DX::AnimationSDKMESH m_animation;  
  
 AnimationState                 mAnimationState;  
  
 Railtaser* gun;  
  
};  
  

#pragma once  
  
#include "pch.h"  
  
class City  
{  
  
public:  
 void CreateDeviceDependentResources();  
 void CreateWindowSizeDependentResources();  
 void Render();  
 void OnDeviceLost();  
  
 DirectX::SimpleMath::Matrix m_world;  
 DirectX::SimpleMath::Matrix m_view;  
 DirectX::SimpleMath::Matrix m_proj;  
  
 std::unique_ptr<DirectX::CommonStates> m_states;  
 std::unique_ptr<DirectX::IEffectFactory> m_fxFactory;  
 std::unique_ptr<DirectX::Model> m_model;  
  
};  
  
  

From Simple3DGame.h

std::vector<Sphere^>                        m_ammo;  
    uint32                                      m_ammoCount;  
    uint32                                      m_ammoNext;  
  
    HighScoreEntry                              m_topScore;  
    PersistentState^                            m_savedState;  
  
    GameTimer^                                  m_timer;  
    bool                                        m_gameActive;  
    bool                                        m_levelActive;  
    int                                         m_totalHits;  
    int                                         m_totalShots;  
    float                                       m_levelDuration;  
    float                                       m_levelBonusTime;  
    float                                       m_levelTimeRemaining;  
    std::vector<Level^>                         m_level;  
    uint32                                      m_levelCount;  
    uint32                                      m_currentLevel;  
  
    Sphere^                                     m_player;  
    std::vector<GameObject^>                    m_objects;           // List of all objects to be included in intersection calculations.  
    std::vector<GameObject^>                    m_renderObjects;     // List of all objects to be rendered.  
  
Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.


Your answer

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