Nasir Christian / Mbed 2 deprecated rpg_game_shell_FA21_Nasir

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers spells.cpp Source File

spells.cpp

00001 #include "spells.h"
00002 #include "speech.h"
00003 #include "globals.h"
00004 #include "hardware.h"
00005 
00006 
00007 
00008 void init_spells()
00009 {
00010     char line1[] = "Water";
00011     char line2[] = "Fire";
00012     char line3[] = "Earth";
00013     vertical_speech1(line1,line2,line3);
00014 
00015 
00016 }
00017 void init_store(){
00018     char line1[] = "Pot$4";
00019     char line2[] = "Elx$5";
00020     char line3[] = "Frt$2";
00021     vertical_speech2(line1,line2,line3);
00022     
00023 }
00024 int spell_used;
00025 
00026 int spell()
00027 {
00028 
00029     
00030 
00031     GameInputs inputs = read_inputs();
00032 
00033     if (!inputs.b1 ) {
00034         erase_vertical_speech_bubble();
00035         char line1[] = "You Cast:";
00036         char line2[] = "Earth";
00037         horizontal_speech2(line1,line2);
00038         spell_used = EARTH;
00039     }
00040     if (!inputs.b2 ) {
00041         erase_vertical_speech_bubble();
00042         char line1[] = "You Cast:";
00043         char line2[] = "Fire";
00044         horizontal_speech2(line1,line2);
00045         spell_used = FIRE;
00046     }
00047     if (!inputs.b3 ) {
00048         erase_vertical_speech_bubble();
00049         char line1[] = "You Cast:";
00050         char line2[] = "Water";
00051         horizontal_speech2(line1,line2);
00052         spell_used = WATER;
00053     }
00054     
00055     return spell_used;
00056 
00057 }
00058 int dinero;
00059 
00060 int store()
00061 {  
00062   
00063 
00064     GameInputs inputs = read_inputs();
00065     if (!inputs.b1 ) {
00066         erase_vertical_speech_bubble();
00067         char line1[] = "You Chose:";
00068         char line2[] = "Fruit";
00069         horizontal_speech2(line1,line2);
00070         
00071          dinero = FRT;
00072         
00073 
00074     }
00075     if (!inputs.b2 ) {
00076         erase_vertical_speech_bubble();
00077         char line1[] = "You Chose:";
00078         char line2[] = "Elixer";
00079         horizontal_speech2(line1,line2);
00080         
00081          dinero = ELX;
00082     }
00083     if (!inputs.b3) {
00084         erase_vertical_speech_bubble();
00085         char line1[] = "You Chose:";
00086         char line2[] = "Potion";
00087         horizontal_speech2(line1,line2);
00088         
00089          dinero = POT;
00090     }
00091     
00092     return dinero;
00093 
00094 }