Hi folks,
I am working on a point and click adventure game in XNA and have decided to implement scripting via LuaInterface to keep my code more flexible. The thing is this is my first major game and also my first intro to scripting. The info available on the net seems scarce.
So I was wondering how I would implement the scripting in my engine. My game is composed of a list of Screens with Update/Draw loops, that is composed of a list of MyTextures that will have animation and state content but currently only have the Draw,isClicked ,isOver,Move methods. I am not currently implementing a conversation manager so the only events MyTexture currently fire are whether the mouse has been clicked or hovered over them. Currently, the engine is at an extremely basic level where i can create/remove multiple screens, turn off their Update/Draw loops, each Screen Update loop has hardcoded checks for input via the MyTexture.isClicked boolean function and the Screen Draw loop calls the MyTexture.Draw which draws the texture at its defined position which can be changed by the MyTexture.Move method.
MyTexture is the closest thing I have to a GameEntities class right now. But I am wondering how to implement Lua into all of this. Do I create a seperate script for each MyTexture object that will handle Look, Use, Talk events? Or do I create an all encompassing script in my Screen's Update loop that checks for events on each MyTexture? The first method will require juggling more files but seems cleaner while the second methood seems more messy especially handling something basic like input in Lua. Can Lua handle custom C# events? Do I create a separate Lua state machine for each MyTexture object or just one for the Screen object? Can I create compiled versions of my lua scripts that LuaInterface can run? And so forth...
Please help and thanks in advance.....