Ikenna Adrian Ozoemena 201157039
Dependencies: mbed
Lore/Lore.cpp
- Committer:
- ikenna1
- Date:
- 2019-05-08
- Revision:
- 41:e1fa36c0492e
- Parent:
- 40:90c7a893d513
- Child:
- 42:ee13e1d103d8
- Child:
- 44:a6a361bea806
File content as of revision 41:e1fa36c0492e:
#include "Lore.h" const int seekerSprite[7][9] = { {1,1,0,0,0,0,0,1,1}, {1,0,1,0,0,0,1,0,1}, {1,0,0,1,1,1,0,0,1}, {0,1,0,0,0,0,0,1,0}, {0,0,1,0,0,0,1,0,0}, {0,0,1,1,0,1,1,0,0}, {0,0,0,0,1,0,0,0,0}, }; const int shooterSprite[10][11] = { {0,0,1,0,0,0,0,0,1,0,0}, {0,1,0,1,0,0,0,1,0,1,0}, {1,0,0,1,0,1,0,1,0,0,1}, {1,0,0,1,1,0,1,1,0,0,1}, {0,1,0,0,0,0,0,0,0,1,0}, {0,1,0,0,1,1,1,0,0,1,0}, {0,0,1,0,0,1,0,0,1,0,0}, {0,0,0,1,0,0,0,1,0,0,0}, {0,0,0,0,1,0,1,0,0,0,0}, {0,0,0,0,0,1,0,0,0,0,0}, }; const int orionSprite[10][7] = { {0,0,0,1,0,0,0}, {0,0,1,0,1,0,0}, {0,1,0,0,0,1,0}, {1,0,0,1,0,0,1}, {0,1,0,0,0,1,0}, {0,0,1,0,1,0,0}, {1,0,0,1,0,0,1}, {1,0,1,0,1,0,1}, {1,1,0,0,0,1,1}, {1,0,0,0,0,0,1}, }; // Constructor Lore::Lore() { } // Destructor Lore::~Lore() { } void Lore::display(N5110 &lcd,int rand) { int random = rand%4; printf("random = %d\n",random); lcd.clear(); lcd.refresh(); switch (random) { case 0: shooter(lcd); break; case 1: seeker(lcd); break; case 2: kestrel(lcd); break; case 3: orion(lcd); break; case 4: imperion(lcd); break; case 5: menu1(lcd); break; } lcd.refresh(); wait(10); } void Lore::seeker(N5110 &lcd) { // _enemy.draw_seeker(lcd); lcd.drawSprite(42,0,7,9,(int *)seekerSprite); lcd.printString(" Seekers ",2,3); lcd.printString(" explode ",2,4); lcd.printString(" on impact ",2,5); } void Lore::shooter(N5110 &lcd) { lcd.drawSprite(16,2,10,11,(int *)shooterSprite); lcd.drawSprite(38,5,10,11,(int *)shooterSprite); lcd.drawSprite(59,2,10,11,(int *)shooterSprite); lcd.printString("Shooters will",2,2); lcd.printString(" allign next ",2,3); lcd.printString("to you before",2,4); lcd.printString(" they fire",2,5); } void Lore::kestrel(N5110 &lcd) { lcd.printString("the kestrel's",2,0); lcd.printString("fire rate ",2,1); lcd.printString("increases the",2,2); lcd.printString("closer you are",2,3); lcd.printString("to danger ",2,4); } void Lore::imperion(N5110 &lcd) { lcd.printString("the imperion ",2,0); lcd.printString(" excels in ",2,1); lcd.printString("damage output ",2,2); lcd.printString(" but is ",2,3); lcd.printString(" immobile ",2,4); lcd.printString("during firing ",2,5); } void Lore::orion(N5110 &lcd) { lcd.drawSprite(70,34,10,7,(int *)orionSprite); lcd.drawLine(70 + 2,34 + 2,45,30,FILL_BLACK); lcd.drawLine(70 + 2,34 + 2,55,48,FILL_BLACK); lcd.printString("the orion is",2,0); lcd.printString("the only ship",2,1); lcd.printString("capable of ",2,2); lcd.printString("harming",2,3); lcd.printString("escaping ",2,4); lcd.printString("enemies ",2,5); } void Lore::menu1(N5110 &lcd) { lcd.printString(" you can ",2,0); lcd.printString(" switch ships ",2,1); lcd.printString(" in the menu ",2,2); lcd.printString("some are better",2,3); lcd.printString(" for certain ",2,4); lcd.printString(" tasks. ",2,5); } void Lore::intro(N5110 &lcd) { lcd.clear(); lcd.refresh(); lcd.printString("You're tasked",2,0); lcd.printString(" with holding",2,1); lcd.printString(" the line ",2,2); lcd.printString(" from an ",2,3); lcd.printString("invading army ",2,4); lcd.refresh(); wait(2); lcd.clear(); lcd.refresh(); lcd.printString(" as an ",2,0); lcd.printString(" expendable ",2,1); lcd.printString(" asset, ",2,2); lcd.printString(" you are not ",2,3); lcd.printString(" expected to",2,4); lcd.printString(" survive ",2,5); lcd.refresh(); wait(1); } /* string pie = "pie"; char buffer[10]; sprintf(buffer,"%s",pie); lcd.printString(buffer,2,0); */