- Home /
Custom Global Functions
Basically my question here is....
Is there a way to make a javascript file that just hold personal functions that I've created for my game. I'm making quite a few functions that would be nice to access from other scripts, but I'd rather not have to keep adding that function to each file. So is there a way to make one file that holds all my functions and just include it?
In a previous game engine there was a #include "script name" and functions from that would be implemented into the new script. This made it easy to keep clean and reuse functions.
Thanks
Answer by runevision · Mar 25, 2010 at 03:58 PM
Yes, you can use a static function. See this question:
Thanks so much! That was what I was looking for. I can assume this works the same for Java? By using public before the function it'll make it usable from anywhere?
Yes! I updated the answer I linked to so it also includes a Javascript translation.
Your answer
Follow this Question
Related Questions
Static function and variables error 2 Answers
Accessing non static members in a static function argument?? 1 Answer
Adding static functions 2 Answers
How do you achieve variables and functions that are global between scenes? What is the BEST way? 1 Answer
siple question...how to comunicate with other script 5 Answers