[Help] When score = 550, create actor

Non-platform specific questions.

[Help] When score = 550, create actor

Postby Garfield501 » Mon Sep 28, 2009 5:26 pm

Hello,
I have a new question.

When my score is 550, I want that an actor is created.
I am using the following script. (LOL, I know I don't have to use the script editor, but that's the only way I saw).
Code: Select all
if (score.textNumber = 550)
{
    CreateActor("game_complete", "icon", "(none)", "(none)", 49, 10, true);
}

But the only thing it does, is setting the score to 550 on start-up.
Garfield501
 
Posts: 25
Joined: Tue Sep 22, 2009 5:45 pm
Score: 0 Give a positive score

Re: [Help] When score = 550, create actor

Postby Kalladdolf » Mon Sep 28, 2009 7:16 pm

if(score.textNumber == 550)
You need two equal signs.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: [Help] When score = 550, create actor

Postby DST » Mon Sep 28, 2009 7:24 pm

It is not recommended to use textNumber as a variable, its only for display. You will likely always have problems if you use it that way.

Use a global variable called score, and just use textNumber as a way to display score.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: [Help] When score = 550, create actor

Postby Garfield501 » Tue Sep 29, 2009 1:46 pm

DST wrote:It is not recommended to use textNumber as a variable, its only for display. You will likely always have problems if you use it that way.

Use a global variable called score, and just use textNumber as a way to display score.

Okay, thanks for the information.
I'll keep this in mind for my real games. (this is just for trying).

Kalladdolf wrote:if(score.textNumber == 550)
You need two equal signs.

Can you explain me why I need to use two "="?
I would like to know that, cause I want to be a game programmer and everything I know about programming in Game-Editor is an advantage.
(I gotta start somewhere, right???)
Garfield501
 
Posts: 25
Joined: Tue Sep 22, 2009 5:45 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron