A complex 2D-dungeon game on LPC1768 in SWJTU-Leeds Joint School XJEL2645 project. Referenced from the framework contributed by https://os.mbed.com/users/Siriagus/code/SimplePlatformGame/
Dependencies: mbed N5110 ShiftReg PinDetect
Music.cpp@21:e19709a07756, 2021-03-25 (annotated)
- Committer:
- hugohu
- Date:
- Thu Mar 25 03:56:22 2021 +0000
- Branch:
- BRAVEHEART
- Revision:
- 21:e19709a07756
- Parent:
- 19:89c3eeb3761b
Combined some files, removed codes for my personal needs, created new maps, new ways to play.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hugohu | 19:89c3eeb3761b | 1 | #include "Music.h" |
hugohu | 19:89c3eeb3761b | 2 | |
hugohu | 19:89c3eeb3761b | 3 | /// @file Sound.cpp |
hugohu | 19:89c3eeb3761b | 4 | |
hugohu | 19:89c3eeb3761b | 5 | Sound::Sound(PinName buzzerPin) |
hugohu | 19:89c3eeb3761b | 6 | { |
hugohu | 19:89c3eeb3761b | 7 | //dac = new Tone(p18); |
hugohu | 19:89c3eeb3761b | 8 | } |
hugohu | 19:89c3eeb3761b | 9 | |
hugohu | 19:89c3eeb3761b | 10 | Sound::~Sound() |
hugohu | 19:89c3eeb3761b | 11 | { |
hugohu | 19:89c3eeb3761b | 12 | // delete dac; |
hugohu | 19:89c3eeb3761b | 13 | } |
hugohu | 19:89c3eeb3761b | 14 | |
hugohu | 19:89c3eeb3761b | 15 | void Sound::playNote(Note ¬e) |
hugohu | 19:89c3eeb3761b | 16 | { |
hugohu | 19:89c3eeb3761b | 17 | /* |
hugohu | 19:89c3eeb3761b | 18 | start(); |
hugohu | 19:89c3eeb3761b | 19 | buzzer->period(1.0/note.frequency); |
hugohu | 19:89c3eeb3761b | 20 | ticker.attach(this, &Sound::stop, 0.5 * note.beat); |
hugohu | 19:89c3eeb3761b | 21 | */ |
hugohu | 19:89c3eeb3761b | 22 | } |
hugohu | 19:89c3eeb3761b | 23 | |
hugohu | 19:89c3eeb3761b | 24 | // Sound effects - definitions |
hugohu | 19:89c3eeb3761b | 25 | namespace SFX |
hugohu | 19:89c3eeb3761b | 26 | { |
hugohu | 19:89c3eeb3761b | 27 | Note PLAYER_DEAD(1174.66, 0.2); |
hugohu | 19:89c3eeb3761b | 28 | Note ENEMY_DEAD(1567.98, 0.1); |
hugohu | 19:89c3eeb3761b | 29 | Note BULLET_FIRED(1661.22, 0.1); |
hugohu | 19:89c3eeb3761b | 30 | Note PLAYER_JUMP(1760.00, 0.2); |
hugohu | 19:89c3eeb3761b | 31 | Note RESTART(1318.51, 1.0); |
hugohu | 19:89c3eeb3761b | 32 | } |