# storyboard and global inventory system (project included)

**URL:** <https://forums.solar2d.com/t/storyboard-and-global-inventory-system-project-included/311295>\
**Category:** Uncategorized\
**Created:** [March 8, 2013, 11:55pm UTC](https://forums.solar2d.com/t/storyboard-and-global-inventory-system-project-included/311295 "2013-03-08T23:55:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamal\_Salim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@Jamal\_Salim](https://forums.solar2d.com/u/Jamal_Salim)\
**Post date:** [March 8, 2013, 11:55pm UTC](https://forums.solar2d.com/t/storyboard-and-global-inventory-system-project-included/311295/1 "2013-03-08T23:55:11Z")

</div>

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](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]

---

<div class="post-metadata">

**Author:** ![Jamal\_Salim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@Jamal\_Salim](https://forums.solar2d.com/u/Jamal_Salim)\
**Post date:** [March 10, 2013, 9:23pm UTC](https://forums.solar2d.com/t/storyboard-and-global-inventory-system-project-included/311295/2 "2013-03-10T21:23:04Z")

</div>

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

Thank you. [import]uid: 225161 topic\_id: 37192 reply\_id: 145575[/import]

---

<div class="post-metadata">

**Author:** ![Jamal\_Salim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@Jamal\_Salim](https://forums.solar2d.com/u/Jamal_Salim)\
**Post date:** [March 10, 2013, 9:23pm UTC](https://forums.solar2d.com/t/storyboard-and-global-inventory-system-project-included/311295/3 "2013-03-10T21:23:04Z")

</div>

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

Thank you. [import]uid: 225161 topic\_id: 37192 reply\_id: 145575[/import]
