Assigning text to an actor

Non-platform specific questions.

Assigning text to an actor

Postby motorollin » Thu Aug 16, 2007 9:18 am

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?
motorollin
 
Posts: 54
Joined: Sun Aug 12, 2007 8:05 am
Score: 1 Give a positive score

Postby DilloDude » Thu Aug 16, 2007 11:02 am

in the event that calls this function, put some reference to livestext; even a comment.
Code: Select all
//livestext;
die();
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby motorollin » Thu Aug 16, 2007 11:05 am

Yes, that works. Thanks! A bug in GE maybe?
motorollin
 
Posts: 54
Joined: Sun Aug 12, 2007 8:05 am
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest