Mortal Kombat Game ELEC2645
Dependencies: mbed N5110 ShiftReg Joystick
Diff: Abandoned.cpp
- Revision:
- 20:4ca04fd0965a
- Parent:
- 18:22bda659c70a
- Child:
- 22:225d4031c090
--- a/Abandoned.cpp Fri Apr 30 03:49:59 2021 +0000 +++ b/Abandoned.cpp Fri May 07 16:58:36 2021 +0000 @@ -1,6 +1,83 @@ // This file includes abandoned code that was replaced /* +void play_MK_theme() { + // Mortal Kombat Theme Tune +const int note_array[] = { + NOTE_A3, NOTE_A3, NOTE_C4, NOTE_A3, + NOTE_D4, NOTE_A3, NOTE_E4, NOTE_D4, + NOTE_C4, NOTE_C4, NOTE_E4, NOTE_C4, + NOTE_G4, NOTE_C4, NOTE_E4, NOTE_C4, + + NOTE_G3, NOTE_G3, NOTE_B3, NOTE_G3, + NOTE_C4, NOTE_G3, NOTE_D4, NOTE_C4, + NOTE_F3, NOTE_F3, NOTE_A3, NOTE_F3, + NOTE_C4, NOTE_F3, NOTE_C4, NOTE_B3, +// ***************************************** + NOTE_A3, NOTE_A3, NOTE_A3, NOTE_A3, + NOTE_G3, NOTE_C4, NOTE_A3, NOTE_A3, + NOTE_A3, NOTE_A3, NOTE_G3, NOTE_E3, + NOTE_A3, NOTE_A3, NOTE_A3, NOTE_A3, + + NOTE_G3, NOTE_C4, NOTE_A3, NOTE_A3, + NOTE_A3, NOTE_A3, NOTE_A3, NOTE_A3, +// ***************************************** + NOTE_A3, NOTE_E4, NOTE_A3, NOTE_C4, + NOTE_A3, NOTE_B3, NOTE_A3, NOTE_C4, + NOTE_A3, NOTE_B3, NOTE_G3, NOTE_A3, + NOTE_E4, NOTE_A3, NOTE_C4, NOTE_A3, + + NOTE_B3, NOTE_A3, NOTE_C4, NOTE_A3, + NOTE_B3, NOTE_G3, NOTE_A3, NOTE_E4, + NOTE_A3, NOTE_C4, NOTE_A3, NOTE_B3, + NOTE_A3, NOTE_C4, NOTE_A3, NOTE_B3, + + NOTE_G3, NOTE_A3, NOTE_E4, NOTE_A3, + NOTE_C4, NOTE_G3, NOTE_G3, NOTE_G3, + NOTE_A3, NOTE_A3, +}; + +// 8 corresponds to 1/8 +const int duration_array[] = { + 7,7,7,7, + 7,7,7,7, + 7,7,7,7, + 7,7,7,7, + + 7,7,7,7, + 7,7,7,7, + 7,7,7,7, + 7,7,7,7, +// ***************************************** + 5,5,5,5, + 7,7,5,5, + 5,5,7,7, + 5,5,5,5, + + 6,6,5,5, + 7,10,7,6, +// ***************************************** + 8,6,8,6, + 8,6,8,6, + 8,8,6,8, + 6,8,6,8, + + 6,8,6,8, + 8,6,8,6, + 8,6,8,6, + 8,6,8,8, + + 6,8,6,8, + 6,8,6,8, + 8,5, +}; + int n = sizeof(note_array)/sizeof(int); + // tell it the number of notes, arrays, BPM and whether to repeat + dac.play_melody(n,note_array,duration_array,110.0,true); +} +*/ +/* Function works but better solutions available + void GameEngine::check_health(N5110 &lcd, DigitalIn &buttonA, DigitalIn &buttonB, DigitalIn &buttonC) { int F = 40; int E = 40; @@ -387,3 +464,72 @@ return button; } */ + +/* +// function - gets user input from buttons A B C D +int Menu::get_user_input(int &input, DigitalIn &buttonA, DigitalIn &buttonB, DigitalIn &buttonC, DigitalIn &buttonD) { + // we use address-of operator for int input to pass the actual reference for the input value not just a copy of it + while (1) { + if (buttonA.read() == 1) { + input = 1; + break; + } + if (buttonB.read() == 1) { + input = 2; + break; + } + if (buttonC.read() == 1) { + input = 3; + break; + } + if (buttonD.read() == 1) { + input = 4; + break; + } + } + printf("input is %i", input); + return input; +} +*/ + +/* +void Menu::menu_selection(N5110 &lcd, DigitalIn &buttonA, DigitalIn &buttonB, DigitalIn &buttonC, DigitalIn &buttonD) { + // this function takes the user input and selects the relevant menu item + + while (1) { + // working code + if (buttonA.read() == 1) { // we use if statement instead of while loop so that button input do not interfere with the next menu, only this one! + play(lcd); + break; + } + if (buttonB.read() == 1) { + tutorial(lcd); + break; + } + if (buttonC.read() == 1) { + options_menu(lcd, buttonA, buttonB, buttonC); + break; + } + if (buttonD.read() == 1) { // user can click button D to return to main menu + homescreen(lcd); + continue; + } + } +} +*/ + + /* + if (input == 1){ // button A pressed + play(lcd); + } + else if (input == 2) { // button B pressed + tutorial(lcd); + } + else if (input == 3) { // button C pressed + options_menu(lcd, buttonA, buttonB, buttonC, buttonD); + } + else if (input == 4) { // button D pressed - return back to main menu + homescreen(lcd); + } + */ +// ******************************************************************************************************************************