storyboard and global inventory system (project included)

Hi, I’m Jamal

I’m working on a “point and click” game, and I need to know if the logic I created is good in terms of memory, performance and Storyboard API. Please consider I’m new with LUA and corona SDK

The idea is very simple, clickable objects will have their own variables (img_name for the image name, dialogue_text to display a certain text once clicked)

There are two types of clickable objects (images):

  • objects that can be added to inventory
    (if the user click this item the if will fade out then will be added to inventory)
  • objects that cannot be add to inventory
    (if the user clicks the object it will display a dialogue box with a certain text)

[lua]
– Clickable Objects | with add to inventory
local saw = display.newImage(“items/saw.png”, 300, 600)
saw.img_name = “items/saw”
saw.allow_touch = true
saw.touch = objects.object_touch_with_add
saw:addEventListener(“touch”,saw)
[/lua]

[lua]
– Clickable Objects | without add to inventory
local window = display.newRect(310, 125, 150, 100)
window.alpha = 0
window.isHitTestable = true
window.allow_touch = true
window.dialogue_text = “. . . . . , it is cold!”
window.touch = objects.object_touch_no_add
window:addEventListener(“touch”, window)
[/lua]

There is an inventory array that consist of object.img_name (this will help printing the array)
add to inventory function will add the “object.img_name”
remove from inventory function will remove the “object.img_name”

what makes me afraid is that there are several .lua files:

  • inventory.lua
  • objects.lua
  • dialogue.lua

all of theme are global so I’m not sure if this is the proper way to do it.

I hope that I explain it correctly, just in case you can download the project form here:
https://www.box.com/s/fdyjt0v6cizq2bwku458

right now it’s working great on the simulator, but since I’m using global inventory (global memory), I’m afraid that my code might crash on actual devices.
can anyone please test the project on iOS or android?

Thanks a lot for your help [import]uid: 225161 topic_id: 37192 reply_id: 67192[/import]

Can anyone please verify the concept? is the code written correctly?

Thank you. [import]uid: 225161 topic_id: 37192 reply_id: 145575[/import]

Can anyone please verify the concept? is the code written correctly?

Thank you. [import]uid: 225161 topic_id: 37192 reply_id: 145575[/import]