|
|
@ -14,7 +14,7 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
int frameCount=0; |
|
|
|
float accumulatedTime=0; |
|
|
|
float accumulatedTime=0; |
|
|
|
const float UPDATE_RATE=1/60.0F; |
|
|
|
const float UPDATE_RATE=1/60.0F; |
|
|
|
char partyMemberCount=1; |
|
|
|
char partyMemberCount=1; |
|
|
@ -45,6 +45,7 @@ public: |
|
|
|
se1.LoadAudioWaveform("./assets/sample-9s.wav"); |
|
|
|
se1.LoadAudioWaveform("./assets/sample-9s.wav"); |
|
|
|
|
|
|
|
|
|
|
|
player_hp[0]=30; |
|
|
|
player_hp[0]=30; |
|
|
|
|
|
|
|
//WriteEmscriptenFile("test","Test?\nThis has more\nthan two lines!");
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -71,6 +72,16 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void updateGame(){ |
|
|
|
void updateGame(){ |
|
|
|
|
|
|
|
frameCount++; |
|
|
|
|
|
|
|
if (frameCount==180) { |
|
|
|
|
|
|
|
std::vector<std::string> data = ReadEmscriptenFile("test"); |
|
|
|
|
|
|
|
for (int i=0;i<data.size();i++) { |
|
|
|
|
|
|
|
cout << data[i] << "\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int i=0;i<data[0].length();i++) { |
|
|
|
|
|
|
|
player_name[0][i]=data[0][i]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
for (int i=0;i<partyMemberCount;i++) { |
|
|
|
for (int i=0;i<partyMemberCount;i++) { |
|
|
|
if (player_rollhp[i]>player_hp[i]) { |
|
|
|
if (player_rollhp[i]>player_hp[i]) { |
|
|
|
if (player_rollhp_counter[i][0]<=0) { |
|
|
|
if (player_rollhp_counter[i][0]<=0) { |
|
|
@ -109,7 +120,7 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void drawBox(const olc::vi2d &pos, const olc::vi2d &size, olc::Pixel p = olc::WHITE, olc::Pixel p2 = olc::DARK_GREY, olc::Pixel p3 = olc::VERY_DARK_GREY) { |
|
|
|
void drawBox(const olc::vi2d &pos, const olc::vi2d &size, olc::Pixel p = olc::WHITE, olc::Pixel p2 = olc::DARK_GREY, olc::Pixel p3 = olc::VERY_DARK_GREY) { |
|
|
|
FillRectDecal({pos.x+3,pos.y+3},{size.x-5,size.y-5},p); |
|
|
|
FillRectDecal({(float)(pos.x+3),(float)(pos.y+3)},{(float)(size.x-5),(float)(size.y-5)},p); |
|
|
|
DrawRect({pos.x,pos.y},size,p2); |
|
|
|
DrawRect({pos.x,pos.y},size,p2); |
|
|
|
DrawRect({pos.x+2,pos.y+2},{size.x-4,size.y-4},p3); |
|
|
|
DrawRect({pos.x+2,pos.y+2},{size.x-4,size.y-4},p3); |
|
|
|
DrawRect({pos.x+1,pos.y+1},{size.x-2,size.y-2},p); |
|
|
|
DrawRect({pos.x+1,pos.y+1},{size.x-2,size.y-2},p); |
|
|
@ -124,20 +135,20 @@ public: |
|
|
|
for (int x=3;x<size.x;x+=checkerboardSize.x*2) { |
|
|
|
for (int x=3;x<size.x;x+=checkerboardSize.x*2) { |
|
|
|
for (int y=3;y<size.y;y+=checkerboardSize.y*2) { |
|
|
|
for (int y=3;y<size.y;y+=checkerboardSize.y*2) { |
|
|
|
if (x+checkerboardSize.x<size.x&&y+checkerboardSize.y<size.y) { |
|
|
|
if (x+checkerboardSize.x<size.x&&y+checkerboardSize.y<size.y) { |
|
|
|
FillRectDecal({x+pos.x,y+pos.y},{checkerboardSize.x,checkerboardSize.y},alternatingCol); |
|
|
|
FillRectDecal({(float)(x+pos.x),(float)(y+pos.y)},{(float)checkerboardSize.x,(float)checkerboardSize.y},alternatingCol); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void DrawRollingCounter(const olc::vi2d &pos,int val,int*rollcounter,int*rolloffset) { |
|
|
|
void DrawRollingCounter(const olc::vi2d &pos,int val,int*rollcounter,int*rolloffset) { |
|
|
|
FillRectDecal({pos.x+20,pos.y-3},{30,13},olc::DARK_GREY); |
|
|
|
FillRectDecal({(float)(pos.x+20),(float)(pos.y-3)},{30,13},olc::DARK_GREY); |
|
|
|
FillRectDecal({pos.x+21,pos.y-2},{28,11},olc::GREY); |
|
|
|
FillRectDecal({(float)(pos.x+21),(float)(pos.y-2)},{28,11},olc::GREY); |
|
|
|
DrawLineDecal({pos.x+30,pos.y-3},{pos.x+30,pos.y+10},olc::DARK_GREY); |
|
|
|
DrawLineDecal({(float)(pos.x+30),(float)(pos.y-3)},{(float)(pos.x+30),(float)(pos.y+10)},olc::DARK_GREY); |
|
|
|
DrawLineDecal({pos.x+40,pos.y-3},{pos.x+40,pos.y+10},olc::DARK_GREY); |
|
|
|
DrawLineDecal({(float)(pos.x+40),(float)(pos.y-3)},{(float)(pos.x+40),(float)(pos.y+10)},olc::DARK_GREY); |
|
|
|
DrawPartialDecal({pos.x+22,pos.y-1},{7,9},rollingCounter,{0,rollcounter[2]*13+rolloffset[2]},{7,9}); |
|
|
|
DrawPartialDecal({(float)(pos.x+22),(float)(pos.y-1)},{7,9},rollingCounter,{0,(float)(rollcounter[2]*13+rolloffset[2])},{7,9}); |
|
|
|
DrawPartialDecal({pos.x+31,pos.y-1},{7,9},rollingCounter,{0,rollcounter[1]*13+rolloffset[1]},{7,9}); |
|
|
|
DrawPartialDecal({(float)(pos.x+31),(float)(pos.y-1)},{7,9},rollingCounter,{0,(float)(rollcounter[1]*13+rolloffset[1])},{7,9}); |
|
|
|
DrawPartialDecal({pos.x+41,pos.y-1},{7,9},rollingCounter,{0,rollcounter[0]*13+rolloffset[0]},{7,9}); |
|
|
|
DrawPartialDecal({(float)(pos.x+41),(float)(pos.y-1)},{7,9},rollingCounter,{0,(float)(rollcounter[0]*13+rolloffset[0])},{7,9}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void drawGame(){ |
|
|
|
void drawGame(){ |
|
|
@ -145,12 +156,12 @@ public: |
|
|
|
for (int i=0;i<partyMemberCount;i++) { |
|
|
|
for (int i=0;i<partyMemberCount;i++) { |
|
|
|
const olc::vi2d box = {(128-32*partyMemberCount)+i*64,160}; |
|
|
|
const olc::vi2d box = {(128-32*partyMemberCount)+i*64,160}; |
|
|
|
drawCheckerboardBox(box,{59,59},olc::Pixel(180,159,194),olc::Pixel(200,179,214),{6,6}); |
|
|
|
drawCheckerboardBox(box,{59,59},olc::Pixel(180,159,194),olc::Pixel(200,179,214),{6,6}); |
|
|
|
DrawStringDecal({box.x+6,box.y+6},player_name[i],olc::BLACK); |
|
|
|
DrawStringDecal({(float)(box.x+6),(float)(box.y+6)},player_name[i],olc::BLACK); |
|
|
|
const olc::vi2d hpTextPos = {box.x+5,box.y+25}; |
|
|
|
const olc::vi2d hpTextPos = {box.x+5,box.y+25}; |
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
if (x!=0&&y!=0) { |
|
|
|
if (x!=0&&y!=0) { |
|
|
|
DrawStringDecal({hpTextPos.x+x,hpTextPos.y+y},"HP",olc::WHITE); |
|
|
|
DrawStringDecal({(float)(hpTextPos.x+x),(float)(hpTextPos.y+y)},"HP",olc::WHITE); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -160,7 +171,7 @@ public: |
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
if (x!=0&&y!=0) { |
|
|
|
if (x!=0&&y!=0) { |
|
|
|
DrawStringDecal({mpTextPos.x+x,mpTextPos.y+y},"PP",olc::WHITE); |
|
|
|
DrawStringDecal({(float)(mpTextPos.x+x),(float)(mpTextPos.y+y)},"PP",olc::WHITE); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|