Variable ''juan'' as true??

Game Editor comments and discussion.

Variable ''juan'' as true??

Postby futuro » Wed Apr 15, 2009 6:01 pm

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
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

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

Postby jimmynewguy » Wed Apr 15, 2009 7:34 pm

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 :)
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

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

Postby futuro » Thu Apr 16, 2009 8:14 am

Ok, then I try it
else
I will ask another time...

Thanks
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

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

Postby futuro » Sat Apr 18, 2009 2:24 pm

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'?
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

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

Postby jimmynewguy » Sat Apr 18, 2009 2:29 pm

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
}
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

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

Postby futuro » Sat Apr 18, 2009 2:48 pm

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
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

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

Postby Kalladdolf » Sun Apr 19, 2009 11:54 am

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.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

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

Postby futuro » Sun Apr 19, 2009 7:46 pm

joder, eres el puto amo...

er:

wow, thanks, your score go to infinite...
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron