Global codes Help. calling

Non-platform specific questions.

Global codes Help. calling

Postby amanuob » Thu Sep 23, 2010 9:59 pm

Umm hello all can anyone help?
Ive been looking around in global code and learend that using
void myfunction(int XXX,int XXX)
{
function
}

but how do I call it?

by putting myfunction(yyy,yyy)
then????

help please XD....
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score

Re: Global codes Help. calling

Postby DST » Thu Sep 23, 2010 10:19 pm

Yes, that is exactly how you call it.

Code: Select all
int iLoop(int xx, int ll, int ul){
if(xx>ul){xx=ll;}
else if(xx<ll){xx=ul;}
return xx;
}


is then called as
Code: Select all
x=iLoop(x, 0, 10);


int will return an integer. Notice the 'return xx' line in the function.

You can return almost anything...

int ()
float ()
char ()
void () - has no return.

Code: Select all
void nothing(int xx){
int i=xx;
}


Code: Select all
nothing(0);


Code: Select all
void evennothinger(){
}


Code: Select all
evennothinger();

Note: The iLoop function is how you might make pac-man move from one side of the screen to the other. (value, lower limit, upper limit); Will loop the integer if it is out of bounds.

x=iLoop(x, 0, view.width);

You could call this at the end of draw actor, after all the normal x functions were called (you can move pacman at will, then call this event at the end of draw actor just to make sure pacman stays onscreen).

x+=5;
x=iLoop(x, 0, view.width);

Once you make the function, it's name should be yellow when you type it in a normal script window (you may have to save and close the global code window first).
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: Global codes Help. calling

Postby amanuob » Sat Sep 25, 2010 4:58 am

Thanx xD......
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest