#170285 - Azenris - Tue Sep 15, 2009 7:48 pm
Can classes use virtual functions on the NDS, I have an enemy class that inherits from mobile.
I wanted to add additional things to the enemy, such as AI but still have the basics of movement, which the basic mobile deals with.
But whenever I use the keyword virtual the screens go upside down and are non responsive.
_________________
My Homebrew Games
Code: |
// =================================================================================
// CLASS: CMobile class CMobile { public: CMobile(CScreenManager *pScreen, u16 tileID, u8 graphicID, u16 health, location loc, u8 unit, bool canRotate); // constructor virtual void Update(void); // update the mobile |
Code: |
/ =================================================================================
// CLASS: CEnemy class CEnemy: public CMobile { public: CEnemy(CScreenManager *pScreen, u16 tileID, u8 graphicID, u16 health, location loc, bool canRotate); // constructor void Update(void); |
Code: |
// =================================================================================
// Update: void CEnemy::Update(void) { // check if the enemy is still and has control if (HasControl() && !IsMoving()) { // depending on the ai, select a move switch (m_ai) { case ENEMY_BODRID: AI_BODRID(this); break; case ENEMY_BLUEY: AI_BLUEY(this); break; case ENEMY_ANGRY: AI_ANGRY(this); break; case ENEMY_WIMPY: AI_WIMPY(this); break; } } // update mobile CMobile::Update(); } |
I wanted to add additional things to the enemy, such as AI but still have the basics of movement, which the basic mobile deals with.
But whenever I use the keyword virtual the screens go upside down and are non responsive.
_________________
My Homebrew Games