Page 1 of 1

Variable ''juan'' as true??

PostPosted: Wed Apr 15, 2009 6:01 pm
by futuro
hi

I need to know one thing:

When I create actor, I create one variable called ''juan'', well, if another actor collision with one actor more...

How I do for variable ''juan'' into a true?
Is this a global variable?
I must to do a variable ''juan'' in global or in a actor?

Thank's for understand me

Re: Variable ''juan'' as true??

PostPosted: Wed Apr 15, 2009 7:34 pm
by jimmynewguy
well it depends what you want to do with it if it's global or not.
if it's like health then global would'nt be good since global is well... global

that probably doesnt make since...well any way if the variable is an integer then use swith or if

if(juan == 1)
{
//enter code
}
for if you can have
">=" "<=" "==" ">" "<"
without quotes

switch is for it the variable does something different for each numeral


switch(juan)
{
case 1://code
break;
case 2://code
break;
ect.
}

i hope i'm making sense :)

Re: Variable ''juan'' as true??

PostPosted: Thu Apr 16, 2009 8:14 am
by futuro
Ok, then I try it
else
I will ask another time...

Thanks

Re: Variable ''juan'' as true??

PostPosted: Sat Apr 18, 2009 2:24 pm
by futuro
And to declared valor of variable ''juan'' as true or one:

Code: Select all
int juan == 1;
...

...
if(juan = 1)
{
//etc to do
}


It's OK or variable ''juan'' declared into the 'if'?

Re: Variable ''juan'' as true??

PostPosted: Sat Apr 18, 2009 2:29 pm
by jimmynewguy
there is also a tab to create variables if you don't want
int juan == 1;

anyway the code should just be

Code: Select all
int juan = 1; //no double equals
if(juan == 1) //double equals
{
//etc to do
}

Re: Variable ''juan'' as true??

PostPosted: Sat Apr 18, 2009 2:48 pm
by futuro
wait a moment...

the corretc is...
Code: Select all
int juan as true;


or
Code: Select all
int juan as 1;


or
Code: Select all
int juan = 1;


What is correct?
the 1, 2, 3
1 & 2
2 & 3
1 & 3
All?

sorry but Iin ''my first day'' of game editor... ¬¬ :lol: (joke)

jimmynewguy your score is go up

Re: Variable ''juan'' as true??

PostPosted: Sun Apr 19, 2009 11:54 am
by Kalladdolf
You can write: int juan;
That creates the variable "juan" which can contain many different values. Right now it contains zero.
int juan = 1; This gives juan the value "1" as soon as the number's created.
int juan = 56; Now juan is 56.
juan = 23; This can be used anywhere in your code now, IF you have created juan at the beginning of the code.
if(juan == 1) If the variable juan is one...
if(juan == 4) {juan = 1;} If juan is 4, change it back to 1.
juan = juan +1; Add 1 to juan.
juan += 1; Means exactly the same.

Now I could continue the list, but I think you get the picture.
You can also use != or < or > or >= or <= in your "if" conditions.

If you int juan in a global code, the variable will be global.
If you int it in another script (such as DrawActor, CreateActor, Collision, MoveFinish), it will be an actor variable.
Global variables can be used for omnipresent things such as Menu, Pause, Music.
Actor variables are better for health, money, score and other individual things.

Re: Variable ''juan'' as true??

PostPosted: Sun Apr 19, 2009 7:46 pm
by futuro
joder, eres el puto amo...

er:

wow, thanks, your score go to infinite...