Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 30/03/2004 02:44:52

Title: does any1 know how to have health and attacking
Post by: on Tue 30/03/2004 02:44:52
please help me with having health for player and being able to have enemies that attack thank you
Title: Re:does any1 know how to have health and attacking
Post by: Radiant on Tue 30/03/2004 13:09:45
in your global script, add 'int health;' at the top, and 'export health;' at the bottom. In your global header, add 'import int health;'.
Then in repeatedly_execute, add something like

 if (AreCharactersColliding (EGO, enemy)) health --;
 if (health <= 0) GUIOn (GameOverGUI);

Title: but how
Post by: on Wed 31/03/2004 01:14:18
but how do i get it to display what health  I have? If some1 tells me that then i can begin making more rooms but first i have to figure out score and music ect. I saw some stuff about the score in another thread so I will have to try that and i tryed what it said to do for music in the help section that comes with AGS but i must have done something wrong because i put i when player eners room i put play track 0 and after I saved it it disapeered.
Title: Re:does any1 know how to have health and attacking
Post by: Scummbuddy on Wed 31/03/2004 01:31:30
what kind of music are you using. have you tried all of the rebuild vox files selections in the menus?  what do you mean it disappeared? the code you told it to execute the sound, that disappeared?
try these links
http://www.agsforums.com/yabb/index.php?board=6;action=display;threadid=12297;start=msg146859#msg146859
http://www.agsforums.com/yabb/index.php?board=6;action=display;threadid=12502;start=msg149278#msg149278
Title: Re:does any1 know how to have health and attacking
Post by: Radiant on Wed 31/03/2004 12:55:16
And as to displaying your health, the easiest way to do it is add a textbox on a GUI (like the title bar at top of the screen).
Then, in repeatedly_execute, add

string buf;
StrFormat (buf, "Your health is %d of %d", health, max_health);
SetLabelText (TITLEBAR_GUI, NUMBER_OF_TEXTBOX, buf);

Title: Re:does any1 know how to have health and attacking
Post by: on Wed 31/03/2004 22:18:36
the music number to play on the play music on room load.the music number was music0


when i add Max_Health in the script it says it i a undefined symbol and i ryed changing the word around.thanks