Crimsondeath
Active member
Hi again, I'm remaking the second bonus stage of Neon Lightning Force, so I'm having a little trouble with the enemy killed counter.
It doesn't update when an enemy is killed x.x:
Here are the code lines I'm using:
update.c
Ondeathscript for the biker enemies:
So I don't know what I'm doing wrong :/ .
It doesn't update when an enemy is killed x.x:
Here are the code lines I'm using:
update.c
C++:
void main(){
setglobalvar("language", 1);
setglobalvar("killedP1", 0);
setglobalvar("killedP2", 0);
drawstring(22, 226, 0, "x "+getglobalvar("killedP1"));
drawsprite(loadsprite("data/bgs/bonus-2/iconbonus2.gif"), 2, 222, 999, 1);
drawstring(291, 226, 0, "x "+getglobalvar("killedP2"));
drawsprite(loadsprite("data/bgs/bonus-2/iconbonus2.gif"), 271, 222, 999, 1);
}
Ondeathscript for the biker enemies:
C++:
void main()
{
void self = getlocalvar("self");
void Pattacker = getlocalvar("other");
void Player1 = getplayerproperty(0, "entity");
void Player2 = getplayerproperty(1, "entity");
int P1BonusScore = getglobalvar("killedP1");
int P2BonusScore = getglobalvar("killedP2");
if(Pattacker == Player1){
P1BonusScore = P1BonusScore + 1;
setglobalvar("killedP1", P1BonusScore); /* <-- This is suppose to increase the counter for player 1. */
}
if(Pattacker == Player2){
P2BonusScore = P2BonusScore + 1;
setglobalvar("killedP2", P2BonusScore);
}
}
So I don't know what I'm doing wrong :/ .