Assigning text to an actor
Posted: Thu Aug 16, 2007 9:18 am
Here is my code for my main player losing a life:
For some reason the text on livesstring, which is an actor which starts off containing the text "2" never changes. I even tried using "strcpy (livestext.text,"Hello World") but it still didn't change. The commands after this to destroy the actors and re-center the view work, so I know it is getting as far as executing these lines of code.
Any ideas?
- Code: Select all
void die()
{
lives-=1; //Take a life
if ( lives < 0 ) gameover(); // Game over if no lives left
sprintf(livesstring,"%d",lives); //Convert the number of lives to a string
strcpy (livestext.text,livesstring); //Show the number of lives
DestroyActor("Event Actor"); //Kill the enemy which killed the player
DestroyActor("player"); //Remove the player
CreateTimer("view", "viewmove", 10); //Re-center the view
}
For some reason the text on livesstring, which is an actor which starts off containing the text "2" never changes. I even tried using "strcpy (livestext.text,"Hello World") but it still didn't change. The commands after this to destroy the actors and re-center the view work, so I know it is getting as far as executing these lines of code.
Any ideas?