74 lines
1.1 KiB
C++
74 lines
1.1 KiB
C++
|
|
||
|
#include "GUI.hpp"
|
||
|
|
||
|
extern "C"
|
||
|
{
|
||
|
#include <math.h>
|
||
|
}
|
||
|
|
||
|
void Script_GUI::Start()
|
||
|
{
|
||
|
|
||
|
vie = 3;
|
||
|
score = 0;
|
||
|
level = 1;
|
||
|
vulnerability = 0;
|
||
|
|
||
|
}
|
||
|
|
||
|
void Script_GUI::UpdateEverySecond()
|
||
|
{
|
||
|
if(vulnerability > 0)vulnerability --;
|
||
|
else vulnerability = 0;
|
||
|
}
|
||
|
|
||
|
void Script_GUI::Update()
|
||
|
{
|
||
|
const unsigned char svie[]={0x6d, 0x93, 0x83, 0x45, 0x29, 0x11, };
|
||
|
|
||
|
ML_rectangle(105,0,127,63,1,ML_WHITE,ML_WHITE);
|
||
|
ML_line(104,0,104,63,ML_BLACK);
|
||
|
|
||
|
PrintMini(107,7,"Score",0);
|
||
|
PrintV(107,15,score);
|
||
|
|
||
|
if(vie > 0)ML_bmp_or(svie,105,30,7,6);
|
||
|
if(vie > 1)ML_bmp_or(svie,113,30,7,6);
|
||
|
if(vie > 2)ML_bmp_or_cl(svie,121,30,7,6);
|
||
|
|
||
|
PrintMini(107,47,"Level",0);
|
||
|
PrintV(115,55,level);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
void Script_GUI::DelVie(int v)
|
||
|
{
|
||
|
if(v < 0)return;
|
||
|
vie -= v;
|
||
|
|
||
|
if(vie <= 0)
|
||
|
{
|
||
|
ML_clear_vram();
|
||
|
PrintXY(25,28,"You Lose",0);
|
||
|
ML_display_vram();
|
||
|
Sleep(1500);
|
||
|
GetEngine()->StopGame();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void Script_GUI::AddScore(int v)
|
||
|
{
|
||
|
if(v > 0)score += v;
|
||
|
}
|
||
|
|
||
|
void Script_GUI::SetVulnerability(int v)
|
||
|
{
|
||
|
if( v > 0)vulnerability = v;
|
||
|
}
|
||
|
|
||
|
int Script_GUI::GetVulnerability()
|
||
|
{
|
||
|
return vulnerability;
|
||
|
}
|