Original Post
Hi, I've been working on my game and realised that hardcoding and simple data files are not enough. I tried to avoid hardcoding as much as i could but i found it difficult - if not impossible - to do. At that point i decided to implement some type of scripting into my engine. I decided on Lua. However i'm having some design issues. Example: I want to make main menu screen. The way it's now: Data class loads graphics, update class(it's polymorphic) checks for clicking and if any of the buttons is clicked it calls respective functions. code: It's really bad becaouse Data has Button1 pointer and such, instead of some general entity collection. How can it be solved using scripts? How far should scritping go, should it just be runned when winning conditions are met or maybe it should control whole game flow? If you have any links to tutorials or articles about a design part of incorporating scripts into engine i would really aprreciate it. I've searched web for a long time but i just can't find any decent tutorials on this topic.
if( intersect(Data->Button1,Data->Mouse_Cursor) && Input->Mouse_click())
{
Manager->PushState(new cGame);
}