Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Buzzy.cpp
00001 #include "Buzzy.h" 00002 #include "Ghosts.h" 00003 #include "BuzzyGraphics.h" 00004 #include "uLCD_4DGL.h" 00005 #include "Speaker.h" 00006 00007 extern char gDynaMaze[MAZE_NUM_ROW][MAZE_NUM_COL]; 00008 extern Ghosts gGhosts[NUM_GHOSTS]; 00009 extern Buzzy gBuzzy; 00010 extern uLCD_4DGL guLCD; 00011 extern Speaker gSpeakerOut; 00012 00013 ///////////////////////////////////////////////////////////////////////// 00014 ///////////////////////////////////////////////////////////////////////// 00015 ///////////////////////////////////////////////////////////////////////// 00016 // Constructor 00017 Buzzy::Buzzy(enDIRECTIONS inDir, unsigned int inRow, unsigned int inCol): 00018 Sprite(inDir, inRow, inCol) 00019 { 00020 00021 } 00022 /////////////////////////////////////////////////////////////////////////////// 00023 /////////////////////////////////////////////////////////////////////////////// 00024 /////////////////////////////////////////////////////////////////////////////// 00025 void Buzzy::Move() 00026 { 00027 00028 if (m_DesiredDirection == NO_DIR) 00029 { 00030 // Nothing to do 00031 // Switch over to the siren sound 00032 gSpeakerOut.SwitchSound(Speaker::SIREN); 00033 return; 00034 } 00035 // Try to move buzzy in the desired direction 00036 00037 // If failed to move in desired directione the try to move Buzzy in old direction 00038 00039 00040 } 00041 /////////////////////////////////////////////////////////////////////////////// 00042 /////////////////////////////////////////////////////////////////////////////// 00043 /////////////////////////////////////////////////////////////////////////////// 00044 void Buzzy::DrawInNewLocation(const int &nRow,const int &nCol) 00045 { 00046 int x1, y1; 00047 // Test if we hit a honeydrop or fruit or ghost 00048 00049 // Clean up the part that will be left 00050 00051 gBuzzy.SetLocation(nRow, nCol); 00052 x1 = (3*m_RowPos+1)-4; 00053 y1 = (3*m_ColPos+1)-4; 00054 guLCD.BLIT(x1, y1, 9, 9, &BuzzyIcon[GetImageIndex()][0][0]); 00055 } 00056 /////////////////////////////////////////////////////////////////////////////// 00057 /////////////////////////////////////////////////////////////////////////////// 00058 /////////////////////////////////////////////////////////////////////////////// 00059 bool Buzzy::DidGhostGetBuzzy() 00060 { 00061 00062 return false; 00063 } 00064 /////////////////////////////////////////////////////////////////////////////// 00065 /////////////////////////////////////////////////////////////////////////////// 00066 /////////////////////////////////////////////////////////////////////////////// 00067 bool Buzzy::IsMoveAllowed(const int &nNewRow, const int &nNewCol) 00068 { 00069 00070 return true; 00071 }
Generated on Wed Jul 13 2022 01:21:55 by
1.7.2