The game is finished
Dependencies: mbed Gamepad N5110 mbed-rtos
Music/Music.cpp
- Committer:
- RexRoshan
- Date:
- 2019-05-09
- Revision:
- 14:c7302ffe6eab
- Parent:
- 7:574c66ebd8b0
File content as of revision 14:c7302ffe6eab:
#include "Music.h" Music::Music() { } Music::~Music() { } void Music::intro_song(Gamepad &pad) // introduction song for the game { while(pad.check_event(Gamepad::START_PRESSED) == false){ pad.tone(293.665, 2); wait(0.8); // thread wait so that two loops can simulatneously run if(pad.check_event(Gamepad::START_PRESSED) == true){break;} // break if start button has been pressed pad.tone(311.127, 2); wait(0.8); if(pad.check_event(Gamepad::START_PRESSED) == true){break;} pad.tone(329.628, 2); wait(0.8); if(pad.check_event(Gamepad::START_PRESSED) == true){break;} pad.tone(349.228, 2); wait(0.8); if(pad.check_event(Gamepad::START_PRESSED) == true){break;} } } void Music::mission_success(Gamepad &pad) // success song { //triplets pad.tone(207.65,0.18); wait(0.2); pad.tone(207.65,0.18); wait(0.2); pad.tone(207.65,0.18); wait(0.2); // 3 beats pad.tone(261.63,0.28); wait(0.3); pad.tone(207.65,0.28); wait(0.3); pad.tone(261.63,0.28); wait(0.3); pad.tone(261.63,0.28); wait(0.30); pad.tone(207.65,0.28); wait(0.30); pad.tone(261.63,0.28); wait(0.30); pad.tone(311.13,1.2); wait(1.2); wait(2.4); }; void Music::mission_fail(Gamepad &pad) // failure song { pad.tone(233.0,0.5); wait(0.5); pad.tone(184.0,0.5); wait(0.5); pad.tone(174.0,2.0); wait(1.0); };