Can I change the value of a text actor dependant on...

Non-platform specific questions.

Can I change the value of a text actor dependant on...

Postby CGameMaker » Thu Jan 05, 2006 8:09 pm

Hi.

I've got a problem. I've got this cool game I'm working on, but I need it so that at the end, on the appropriate "Game Over" screen, it says a different thing dependant on the Score and Level the player reached. These are determined by the numerical values of "score" and "levelno", respectively.

To sum it up, I want the value of a text actor to change when the "score" or "level" reaches a certain value. But this actor (which I have named "code") is not a number. How can I do this?

I have tried the following code, but it doesn't seem to work, so I need to know if there is another way. Thanks!

Code: Select all
if(levelno.textNumber > 2 && score.textNumber > 2119)
{
    code.text == "COMPLETION CODE";
}
else if(levelno.textNumber < 2)
 {
     code.text == "EXAMPLE TEXT 1";
 }
else if(levelno.textNumber == 2)
{
    code.text == "EXAMPLE TEXT 2";
}
else if(levelno.textNumber > 2 && score.textNumber < 2120)
{
code.text == "EXAMPLE TEXT 3";
}
else
code.text == "";
Making Games for all!

    Things that annoy me:
  • Admin'ing phpBB. It's so much better for me to use phpBB than to Admin it.
  • People replying to topics when I already have posted the solution.


For Game Editor :: Against Game Maker.
CGameMaker
 
Posts: 4
Joined: Mon Jan 02, 2006 6:10 am
Score: 0 Give a positive score

Postby makslane » Fri Jan 06, 2006 7:33 pm

With strings, you must use the strcpy function to copy:

strcpy(code.text, "COMPLETION CODE");
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby CGameMaker » Fri Jan 06, 2006 9:29 pm

*Laughs* So that's what strcopy() function is for! I heard people saying about itt, but I did not understand what it was. Thank you makslane.
Making Games for all!

    Things that annoy me:
  • Admin'ing phpBB. It's so much better for me to use phpBB than to Admin it.
  • People replying to topics when I already have posted the solution.


For Game Editor :: Against Game Maker.
CGameMaker
 
Posts: 4
Joined: Mon Jan 02, 2006 6:10 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron