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.
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
spells.cpp@7:862062ffca62, 2021-11-20 (annotated)
- Committer:
- nasiromar
- Date:
- Sat Nov 20 03:37:50 2021 +0000
- Revision:
- 7:862062ffca62
- Parent:
- 6:c9695079521d
- Child:
- 14:7225da81314a
Base Model without game over
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nasiromar | 6:c9695079521d | 1 | #include "spells.h" |
| nasiromar | 6:c9695079521d | 2 | #include "speech.h" |
| nasiromar | 6:c9695079521d | 3 | #include "globals.h" |
| nasiromar | 6:c9695079521d | 4 | #include "hardware.h" |
| nasiromar | 6:c9695079521d | 5 | |
| nasiromar | 7:862062ffca62 | 6 | |
| nasiromar | 6:c9695079521d | 7 | |
| nasiromar | 6:c9695079521d | 8 | void init_spells() |
| nasiromar | 6:c9695079521d | 9 | { |
| nasiromar | 6:c9695079521d | 10 | char line1[] = "Water"; |
| nasiromar | 6:c9695079521d | 11 | char line2[] = "Fire"; |
| nasiromar | 6:c9695079521d | 12 | char line3[] = "Earth"; |
| nasiromar | 6:c9695079521d | 13 | vertical_speech(line1,line2,line3); |
| nasiromar | 6:c9695079521d | 14 | |
| nasiromar | 6:c9695079521d | 15 | |
| nasiromar | 6:c9695079521d | 16 | } |
| nasiromar | 6:c9695079521d | 17 | |
| nasiromar | 6:c9695079521d | 18 | int spell() |
| nasiromar | 6:c9695079521d | 19 | { |
| nasiromar | 6:c9695079521d | 20 | |
| nasiromar | 6:c9695079521d | 21 | int spell_used; |
| nasiromar | 6:c9695079521d | 22 | |
| nasiromar | 6:c9695079521d | 23 | GameInputs inputs = read_inputs(); |
| nasiromar | 6:c9695079521d | 24 | if (!inputs.b1) { |
| nasiromar | 6:c9695079521d | 25 | erase_vertical_speech_bubble(); |
| nasiromar | 6:c9695079521d | 26 | char line1[] = "You Cast:"; |
| nasiromar | 6:c9695079521d | 27 | char line2[] = "Earth"; |
| nasiromar | 6:c9695079521d | 28 | horizontal_speech2(line1,line2); |
| nasiromar | 6:c9695079521d | 29 | |
| nasiromar | 6:c9695079521d | 30 | return spell_used = EARTH; |
| nasiromar | 6:c9695079521d | 31 | } |
| nasiromar | 6:c9695079521d | 32 | if (!inputs.b2) { |
| nasiromar | 6:c9695079521d | 33 | erase_vertical_speech_bubble(); |
| nasiromar | 6:c9695079521d | 34 | char line1[] = "You Cast:"; |
| nasiromar | 6:c9695079521d | 35 | char line2[] = "Fire"; |
| nasiromar | 6:c9695079521d | 36 | horizontal_speech2(line1,line2); |
| nasiromar | 6:c9695079521d | 37 | |
| nasiromar | 6:c9695079521d | 38 | return spell_used = AIR; |
| nasiromar | 6:c9695079521d | 39 | } |
| nasiromar | 6:c9695079521d | 40 | if (!inputs.b3) { |
| nasiromar | 6:c9695079521d | 41 | erase_vertical_speech_bubble(); |
| nasiromar | 6:c9695079521d | 42 | char line1[] = "You Cast:"; |
| nasiromar | 6:c9695079521d | 43 | char line2[] = "Water"; |
| nasiromar | 6:c9695079521d | 44 | horizontal_speech2(line1,line2); |
| nasiromar | 6:c9695079521d | 45 | |
| nasiromar | 6:c9695079521d | 46 | return spell_used = WATER; |
| nasiromar | 6:c9695079521d | 47 | } |
| nasiromar | 6:c9695079521d | 48 | |
| nasiromar | 6:c9695079521d | 49 | |
| nasiromar | 6:c9695079521d | 50 | } |