Page 1 of 1

Assigning text to an actor

PostPosted: Thu Aug 16, 2007 9:18 am
by motorollin
Here is my code for my main player losing a life:

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?

PostPosted: Thu Aug 16, 2007 11:02 am
by DilloDude
in the event that calls this function, put some reference to livestext; even a comment.
Code: Select all
//livestext;
die();

PostPosted: Thu Aug 16, 2007 11:05 am
by motorollin
Yes, that works. Thanks! A bug in GE maybe?