Game For ECE 2035
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
spells.cpp@6:c9695079521d, 2021-11-19 (annotated)
- Committer:
- nasiromar
- Date:
- Fri Nov 19 22:03:25 2021 +0000
- Revision:
- 6:c9695079521d
- Child:
- 7:862062ffca62
Basics
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 | 6:c9695079521d | 6 | #define FIRE 0 |
nasiromar | 6:c9695079521d | 7 | #define WATER 1 |
nasiromar | 6:c9695079521d | 8 | #define AIR 2 |
nasiromar | 6:c9695079521d | 9 | #define EARTH 3 |
nasiromar | 6:c9695079521d | 10 | |
nasiromar | 6:c9695079521d | 11 | void init_spells() |
nasiromar | 6:c9695079521d | 12 | { |
nasiromar | 6:c9695079521d | 13 | char line1[] = "Water"; |
nasiromar | 6:c9695079521d | 14 | char line2[] = "Fire"; |
nasiromar | 6:c9695079521d | 15 | char line3[] = "Earth"; |
nasiromar | 6:c9695079521d | 16 | vertical_speech(line1,line2,line3); |
nasiromar | 6:c9695079521d | 17 | |
nasiromar | 6:c9695079521d | 18 | |
nasiromar | 6:c9695079521d | 19 | } |
nasiromar | 6:c9695079521d | 20 | |
nasiromar | 6:c9695079521d | 21 | int spell() |
nasiromar | 6:c9695079521d | 22 | { |
nasiromar | 6:c9695079521d | 23 | |
nasiromar | 6:c9695079521d | 24 | int spell_used; |
nasiromar | 6:c9695079521d | 25 | |
nasiromar | 6:c9695079521d | 26 | GameInputs inputs = read_inputs(); |
nasiromar | 6:c9695079521d | 27 | if (!inputs.b1) { |
nasiromar | 6:c9695079521d | 28 | erase_vertical_speech_bubble(); |
nasiromar | 6:c9695079521d | 29 | char line1[] = "You Cast:"; |
nasiromar | 6:c9695079521d | 30 | char line2[] = "Earth"; |
nasiromar | 6:c9695079521d | 31 | horizontal_speech2(line1,line2); |
nasiromar | 6:c9695079521d | 32 | |
nasiromar | 6:c9695079521d | 33 | return spell_used = EARTH; |
nasiromar | 6:c9695079521d | 34 | } |
nasiromar | 6:c9695079521d | 35 | if (!inputs.b2) { |
nasiromar | 6:c9695079521d | 36 | erase_vertical_speech_bubble(); |
nasiromar | 6:c9695079521d | 37 | char line1[] = "You Cast:"; |
nasiromar | 6:c9695079521d | 38 | char line2[] = "Fire"; |
nasiromar | 6:c9695079521d | 39 | horizontal_speech2(line1,line2); |
nasiromar | 6:c9695079521d | 40 | |
nasiromar | 6:c9695079521d | 41 | return spell_used = AIR; |
nasiromar | 6:c9695079521d | 42 | } |
nasiromar | 6:c9695079521d | 43 | if (!inputs.b3) { |
nasiromar | 6:c9695079521d | 44 | erase_vertical_speech_bubble(); |
nasiromar | 6:c9695079521d | 45 | char line1[] = "You Cast:"; |
nasiromar | 6:c9695079521d | 46 | char line2[] = "Water"; |
nasiromar | 6:c9695079521d | 47 | horizontal_speech2(line1,line2); |
nasiromar | 6:c9695079521d | 48 | |
nasiromar | 6:c9695079521d | 49 | return spell_used = WATER; |
nasiromar | 6:c9695079521d | 50 | } |
nasiromar | 6:c9695079521d | 51 | |
nasiromar | 6:c9695079521d | 52 | |
nasiromar | 6:c9695079521d | 53 | } |