diff --git a/XMLreader.cpp b/XMLreader.cpp index de803f06b0531e87b7f1ee23486eb77693825456..a871352ebb204f4bea494602a5d17a7f5d937f2d 100644 --- a/XMLreader.cpp +++ b/XMLreader.cpp @@ -29,4 +29,5 @@ void XMLreader::process(string filename) { lines.popTag(); //Popping tag for speech } lines.popTag(); //Popping for trump -} \ No newline at end of file +} + diff --git a/enemy.cpp b/enemy.cpp index 0ad50f46634ad70a54789ddd5d9e6f008c14f7bf..e065bfd7e4b60d416229c9c1210b8293f29135f6 100644 --- a/enemy.cpp +++ b/enemy.cpp @@ -35,6 +35,11 @@ void enemy::enemyDefend() } +void enemy::mousePressedInteractions() +{ + +} + enemy::~enemy() { diff --git a/enemy.h b/enemy.h index 2bb585d9a5cb543d4872cdfdc00738cf5b961f06..57edcd29eebbccd811d40fc846dcc33d0ffa1e3f 100644 --- a/enemy.h +++ b/enemy.h @@ -23,6 +23,7 @@ public: void enemyAttack(float damage); void enemyDefend(); //The first variable is the playerHealth, the second is the damage the NPC will do! + ; ~enemy(); protected: //Variables that can only be accessed with inhertiance float xPos; diff --git a/farage.cpp b/farage.cpp index 4d853d5fdaa3d58f9994b5561459cbe6a2108719..b00a7517873993a64ea25d3693147e0111eac234 100644 --- a/farage.cpp +++ b/farage.cpp @@ -10,7 +10,9 @@ farage::farage(float x, float y) : enemy(20,100,0,0,0) { //The values of the ene } void farage::setup() { - lines.readLine("trump.txt"); + + XMLlines.process("farage.xml"); //This is the line that processes + } void farage::draw() { //Put visual code here diff --git a/farage.h b/farage.h index 5c1f40b89074c4208cef9358ef3630cd11e4b4c8..70e874d0f0030588a3cc2a445688b9903d9a6c4d 100644 --- a/farage.h +++ b/farage.h @@ -12,6 +12,7 @@ class farage : public enemy { void setup(); linereader lines; //Declaring a line reader file, each file is diffirent float mapped; + vector <string> linesXML; private: ofMaterial material; }; diff --git a/ofApp.cpp b/ofApp.cpp index 3e1d992d9687389d78c6ec46f24e32af670e7e87..62877739fdd4bc3448e6c786ccddd40d5d6199b6 100644 --- a/ofApp.cpp +++ b/ofApp.cpp @@ -15,7 +15,7 @@ void ofApp::setup(){ winWidth = ofGetWidth(); winHeight = ofGetHeight(); - //XML Reading Stuff + } //-------------------------------------------------------------- @@ -74,9 +74,7 @@ void ofApp::draw(){ //Enemy Appearence TrumpEnemy.imageDraw(ofGetWidth() / 2 - 250 + enemyMoveX, ofGetHeight() / 2 - 250 + enemyMoveY); //Position for the character head - TrumpEnemy.draw(); - TrumpEnemy.enemyDefend(); //HUD RELATED FUNCTIONS @@ -108,13 +106,6 @@ void ofApp::draw(){ ofDrawBitmapString("Player HP : " + ofToString(playerValues.health), 500, 10); ofDrawBitmapString("Player SP : " + ofToString(playerValues.skill), 500, 30); - ////Enemy Headline - //ofSetColor(0); - //ofRect(0, ofGetHeight() * 0.70, ofGetWidth(), ofGetHeight() * 0.09); - //ofSetColor(255); - - //lineText.drawString("Trump : " + TrumpEnemy.lines.getLine(lineChanger), winWidth*0.1, winHeight*0.76); - } //-------------------------------------------------------------- @@ -140,22 +131,12 @@ void ofApp::mouseDragged(int x, int y, int button){ //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ - if (mouseX > 0 && mouseX < winWidth*0.33 && mouseY > winHeight*0.75) - { - std::cout << "this works " << std::endl; - TrumpEnemy.enemyAttack(1); - - if (lineChanger < TrumpEnemy.lines.phrases.size()) - { - lineChanger += 1; - } - } + TrumpEnemy.enemyAttack(1); } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ - playerValues.playerLoseHealth(2); } //-------------------------------------------------------------- diff --git a/trump.cpp b/trump.cpp index 100d8d52850f9c19ed5edefd0c24aa34ebdff714..f4d5fb0727a60693a844192c379ce7cac59390c7 100644 --- a/trump.cpp +++ b/trump.cpp @@ -4,9 +4,7 @@ trump::trump(float x, float y) : enemy(10,100,0,0,0) { //The values of the enemy xPos = x; - yPos = y; - - mapped = health; + yPos = y;; } void trump::setup() { @@ -15,6 +13,12 @@ void trump::setup() { } void trump::draw() { + //This variable simply handles the method to make the text loading effect + timeMeasure += ofGetFrameNum(); //Set to 500 to turn off the strobe effect + + //Health Bar Calculation (SCALE NOT PERFECT) + mapped = ofMap(health, 0, 10, 0, ofGetWidth() - 70); + //Put visual code here ofDrawBitmapString("Health : " + ofToString(health), 10, 10); ofDrawBitmapString("Skill : " + ofToString(skillLevel), 10, 30); @@ -27,24 +31,29 @@ void trump::draw() { ofRect(0, ofGetHeight() * 0.82, ofGetWidth(), ofGetHeight() * 0.08); ofRect(0, ofGetHeight() * 0.90, ofGetWidth(), ofGetHeight() * 0.08); + ofSetColor(0); + ofRect(30, 10, ofGetWidth() - 60, ofGetHeight() * 0.075); + ofSetColor(0,255,0); + ofRect(35, 15, mapped, ofGetHeight() * 0.06); for (int i = 0; i < 1; i++) { ofSetColor(255); - lineText.drawString("Trump : " + XMLlines.text[i], ofGetWidth()*0.1, ofGetHeight()*0.71); // Question - - ofSetColor(0); - lineText.drawString("1. " + XMLlines.answer[i], ofGetWidth()*0.1, ofGetHeight()*0.80); - lineText.drawString("2. " + XMLlines.wrongAnswer1[i], ofGetWidth()*0.1, ofGetHeight()*0.88); - lineText.drawString("3. " + XMLlines.wrongAnswer2[i], ofGetWidth()*0.1, ofGetHeight()*0.96); - - - + if (timeMeasure > 300 && loopCheck < XMLlines.text[2].size()) //This if statement allows for the loading animation in the program + { + loopCheck = loopCheck + 1; + timeMeasure = 0; + } + lineText.drawString("Trump : " + XMLlines.text[2].substr(0,loopCheck), ofGetWidth()*0.1, ofGetHeight()*0.71); // Question - - - //ofNoFill(); + if (loopCheck == XMLlines.text[2].size()) + { + ofSetColor(0); + lineText.drawString("1. " + XMLlines.answer[2], ofGetWidth()*0.1, ofGetHeight()*0.80); + lineText.drawString("2. " + XMLlines.wrongAnswer1[2], ofGetWidth()*0.1, ofGetHeight()*0.88); + lineText.drawString("3. " + XMLlines.wrongAnswer2[2], ofGetWidth()*0.1, ofGetHeight()*0.96); + } } diff --git a/trump.h b/trump.h index 72910a717634d6bc9dedfb7b3c34abc07924e512..30271d1b762cc5bb62400400d4276704c6686f1d 100644 --- a/trump.h +++ b/trump.h @@ -8,7 +8,7 @@ class trump : public enemy { public: - trump(float x, float y); + trump(float x, float y); void draw(); void setup(); linereader lines; //Declaring a line reader file, each file is diffirent @@ -17,7 +17,10 @@ class trump : public enemy { private: ofMaterial material; + float timeMeasure; + string result; + int loopCheck; }; #endif