void main()
{
float hRes = openborvariant("hresolution");
float vRes = openborvariant("vresolution");
float time = openborvariant("game_time");
float seconds = 200;
float time = openborvariant("game_time")/seconds;
int font = 1;
int xPos = (hRes-strwidth(""+time, font))/2; //MAINTAIN ALWAYS CENTRALIZED ON THE SCREEN
int yPos = 180; //BASE Y POSITION
int layer = 10001; //BASE Z LAYER
//DRAW CLOCK
drawstring(xPos, yPos, font, time, layer);
}
name RefPlays
type none
health 60
animationscript data/scripts/wasitS.c
ondrawscript data/scripts/playerwin.c
load WinLose2
load Announce
#diesound data/sounds/SND_COM2_8.wav
anim spawn
@script
if(frame==1 && openborvariant("count_players")==1){ // Player vs enemy
void P1 = getplayerproperty(0, "entity");
void P2 = getplayerproperty(1, "entity");
if(P1){
setglobalvar("F1", P1);
} else if(P2){
setglobalvar("F2", P2);
}
}
if(frame>=1 && openborvariant("count_players")==2){ // Player vs player
void P1 = getplayerproperty(0, "entity");
void P2 = getplayerproperty(1, "entity");
if(P1 && P2){
void self = getlocalvar("self");
setglobalvar("F1", P1);
setglobalvar("F2", P2);
changeentityproperty(P2, "direction", 0);
//setidle(self, openborconstant("ANI_IDLE"));
}
}
if(frame == 3){
void self = getlocalvar("self");
setidle(self, openborconstant("ANI_IDLE"));
}
@end_script
delay 2
offset 1 1
frame data/chars/misc/empty.gif # 0 - 2
frame data/chars/misc/empty.gif # 1 - 4
delay 459
frame data/chars/misc/empty.gif # 2 - 463
frame data/chars/misc/empty.gif # 3 - change to idle quickly if script is set
anim idle
@script
void self = getlocalvar("self");
int Health = getentityproperty(self, "health");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int T1 = findtarget(P1);
int T2 = findtarget(P2);
int HP1 = getentityproperty(P1, "health");
int HP2 = getentityproperty(P2, "health");
int THP1 = getentityproperty(T1, "health");
int THP2 = getentityproperty(T2, "health");
int index = getlocalvar("player");
void player = getplayerproperty(index, "entity");
void pBase = getentityproperty(player, "base");
int Py = getentityproperty(player, "y");
void target = findtarget(player);
void tBase = getentityproperty(target, "base");
void Ty = getentityproperty(target, "y");
if(frame==1){
void self = getlocalvar("self");
int Habis = Desid();
if(Habis>=1){
performattack(self, openborconstant("ANI_FOLLOW1"));
}
}
if(frame == 4){
changeentityproperty(self, "health", Health-1);
int Habis2 = Desid();
if(Health <= 0){
performattack(self, openborconstant("ANI_DIE"));
}
}
if(frame >= 5){
if(Health <= 0 && pBase == Py && tBase == Ty){
performattack(self, openborconstant("ANI_DIE"));
}
}
@end_script
loop 1 #1
delay 2
offset 1 1
frame data/chars/misc/empty.gif #0
frame data/chars/misc/empty.gif #1
frame data/chars/misc/empty.gif #2
frame data/chars/misc/empty.gif #3
delay 5 #105
#delay 1
frame data/chars/misc/empty.gif #4 - 5
frame data/chars/misc/empty.gif # 5 - 10
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
spawn RefPlays 1
health 10
coords 160 200
at 0
void main(){
//RoundCount();
levelTimer();
}
void levelTimer(){
// Timer display
void self = getlocalvar("self");
int hp = getentityproperty(self, "health");
void ani = getentityproperty(self, "animationid");
void branch = openborvariant("current_branch");
//void sprite = loadsprite("data/sprites/versus.png");
if(ani == openborconstant("ANI_FOLLOW3") && hp > 0 ){
changeentityproperty(self, "health", 0);
//drawstring(153,7,6,"00");
}
//Referee health as timer
if(hp>=130){
drawstring(153,7,6,hp);
}else if(hp>=122 && hp < 130){
drawstring(153,7,6,hp);
}else if(hp==121){
drawstring(155,7,6,hp);
}else if(hp==120){
drawstring(153,7,6,hp);
}else if(hp >= 112 && hp < 120){
drawstring(155,7,6,hp);
}else if(hp == 111){
drawstring(157,7,6,hp);
}else if(hp == 110){
drawstring(155,7,6,hp);
}else if(hp>=100 && hp < 110){
drawstring(153,7,6,hp);
}else if(hp<100 && hp>= 20){
drawstring(155,7,6,hp);
}else if(hp<20 && hp>=10){
drawstring(157,7,6,hp);
}else if(hp<10){
drawstring(155,7,6,"0"+hp);
}
}