Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Wed 26/11/2003 10:36:52

Title: Question about GlobalInt
Post by: on Wed 26/11/2003 10:36:52
HI
I want the player character to be able to kill another character in the game. So I wrote these lines:

if (GetGlobalInt(31)== 1) Display ("No!");
else  if (GetGlobalInt(31)== 0)  setGlobalInt(31,1);Display ("Die!!"); SetCharacterView(R,1); AnimateCharacter(R,4,3,0);

It works okay the animation of the other character collapsing and dying works.
THE PROBLEM IS: you can kill him over and over again, even though "SetGlobalInt 31,1".
The first time i kill him it works fine, skipping the first line, it says "Die" and loads the animation, the second time i try (when the killed one is "dead"") It says "No" then it runs the next line saying "die" and loads the whole animation again, Why when the GlobalInt 31 is set to 1?
/hartan
Title: Re:Question about GlobalInt
Post by: Gilbert on Wed 26/11/2003 11:04:39
Simple fix ;) :

if (GetGlobalInt(31)== 1) Display ("No!");
else if (GetGlobalInt(31)== 0) { setGlobalInt(31,1);Display ("Die!!"); SetCharacterView(R,1); AnimateCharacter(R,4,3,0);
}
Title: Re:Question about GlobalInt
Post by: on Wed 26/11/2003 11:30:26
yeah, it works fine now! thanks a lot!!