Not sure how to put the title.
Here is my situation. My storyboard stores all character info since character change between scenes.
Eg:
local sb = require "storyboard"
sb.character = { speed, health, stamina... }
I have an object module that creates objects (sprites). The object will have event listener attached when it is created. The function that is listening to the object when it is pressed will somehow affect player’s stats like reduce health etc…
Eg:
-- obj.lua
local function createObj( objData )
local sheet = ...
local obj = display.newSprite(...)
local function onRelease( event )
-- reduce player's stamina (for example)
end
obj:addEventListener( "touch", onRelease )
return obj
Should i pass in the character table while creating an object? Or should i just add require “storyboard” in the object module. Which is better? [import]uid: 74723 topic_id: 27470 reply_id: 327470[/import]