does any1 know how to have health and attacking

Started by , Tue 30/03/2004 02:44:52

Previous topic - Next topic

death333

please help me with having health for player and being able to have enemies that attack thank you

Radiant

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
Code: ags

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


death333

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.

Scummbuddy

#3
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
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Radiant

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
Code: ags

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


death333

#5
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

SMF spam blocked by CleanTalk