how to use custom functions? example?

Posted:
Mon Dec 31, 2007 3:09 am
by edh
Hi, I asked a question today about using custom functions in GE, but it's no longer listed under my posts and I cannot find it. Was it moderated?
Re: my post is lost? deleted?

Posted:
Mon Dec 31, 2007 3:21 am
by makslane
I'm sorry, here is your original question:
Hi everyone, I'm kind of new to game-editor. For background, I have the full version and I've been experimenting by writing a TicTacToe (noughts and crosses) game for my GP2X F-200. It's going very well, but I know I need to figure out some of GE's nuances to improve my game designs going forward. Questions about other things may come later. But for now...
The game will have three AI levels (Easy, pretty much random AI choices; Medium, AI makes good choices by has a flaw in the logic; Impossible, the AI plays a perfect game). I have the AI written in C++ already and it works the way i want it to.
So, my question is this: how do you use custom functions? I want the code to be in a file, like ai.c, and just make calls to it from the even handlers. Is this how it works?
Does anyone have an example? I couldn't find a topic in the forums that matched my searches.
Thanks for any help
-E
Re: my post is lost? deleted?

Posted:
Mon Dec 31, 2007 3:25 am
by makslane
- Code: Select all
I have the AI written in C++ already and it works the way i want it to.
Game Editor only supports C, not C++ classes.
how do you use custom functions?
Put your functions in the Global code editor and call in the Script actions.
Does anyone have an example?
Look the Checkers demo:
http://game-editor.com/games/checkers.zip