I am trying to make my code structured by adopting OOP (object-oriented) concept
With that in mind, other than putting all my game logic in scene file (am using Corona StoryBoard)
Currently, creating a board game
And in order to make them more sense, i call each module an ACTOR (score, board, countdown timer)
Each actor has process their own game logic (that’s my intension)
I inited all my modules beginning of the lua file in Scene LUA file
local score = require 'score' local board = require 'board' local countdowntm = require 'countdowntm'
When i start program, it’s look clean & easy. But after awhile, when the game logic grown, i found it quite tough.
E.g. in my board.lua file, i have a method
function board:gameFinish() .. diff code logic score:calculateGameScore... end
each ACTOR are interrelated, they are calling each other in order to perform their own game logic (e.g. score calculate scoring logic, board detect game states, etc…)
But corona keeps on complain error, nil, but i think it would be great if they are GLOBAL and visible to each other (problem is how to do that?)
Thanks for your time reading and i hope to get some advices from corona/lua gurus.
Regards,
Weilies