O'Reilly logo

Developing Mobile Games with Moai SDK by Francisco Tufro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Resource manager

We will now create our resource manager. This module will be in charge of creating and storing our decks and assets in general. We’ll retrieve the assets with one single command, and they’ll come from the cache or get created using the definition.

We need to create a file named resource_manager.lua and add the following line to it:

module ( “ResourceManager”, package.seeall )

This is the same as in the resource definitions; we’re creating a module that will be accessed using ResourceManager.

ASSETS_PATH = ‘assets/’

We now create the ASSETS_PATH constant. This is the path where we will store our assets. You could have many paths for different kinds of assets, but in order to keep things simple, we’ll keep all of them in one single directory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required