The manual mentions that object oriented type stuff is possible, and looking at the Zoom module created by SSH, I can see where he created what appears to be an instance of the class Zoom. He called it zzz.
Where is the class Zoom defined? Anyone care to post a small class definition I can peek at to get the idea of how they are structured in AGS? Any other tips, help, anything you have to say on the subject is greatly appreciated.
Note that I am pretty familiar with classes and instances in C++.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23527.msg247166#msg247166
Quote from: strazer on Wed 30/11/2005 07:35:32
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23527.msg247166#msg247166
Thanks so much. That got me started in the right direction.
I will hijack this, because I have a small question that fits the thread description perfectly and since the original question is answered, I don't see nothing wrong with it...
Scotch recently mentioned, that there is now the possibility to add functions to a struct (thus acting pretty much like a c++ class). How does that work? I searched but couldn't find anything and scotch didn't answer to my PM...
Thanks!
You import the function:
struct ExampleStruct {
import int DoSomething(int param);
import static void DoNothing();
protected int value;
};
int ExampleStruct::DoSomething(int param) {
this.value += param;
return this.value;
}
static void ExampleStruct::DoNothing() {
/* this function does nothing, but note due to it's static nature it does not contain a 'this' pointer or access to member variables */
}
// in game_start
ExampleStruct ExampleItem;
ExampleItem.DoSomething(5);
ExampleStruct.DoNothing();
Ah, thanks a bunch, monkey_05_06!