Created
March 27, 2013 21:21
-
-
Save jeiting/5258112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- How I want to use Sprites | |
-- By: Jacob Eiting | |
--[[ File system contents | |
main.lua | |
faces.lua | |
faces-hd.lua | |
faces.png | |
faces-hd.png | |
pop.png | |
pop-hd.png | |
kansas/ | |
logo.png | |
]] | |
-- load a sprite sheet | |
Sprite.loadSpritesheet("faces") | |
-- create a sprite from that sheet | |
local jacob = Sprite.spriteWithName("jacob.png") -- returns a moai prop with all the write stuff | |
local aaron = Sprite.spriteWithName("aaron.png") | |
-- create a sprite from a file | |
-- checks the cache, if no frame, hit the file system | |
-- this will load the file and make it a texture and create a 'frame' and add it to the cache | |
local pop = Sprite.spriteWithName("pop.png") | |
-- this will create a second sprite using the same texture created in the previous step | |
local pop2 = Sprite.spriteWithName("pop.png") | |
--[[ | |
How we implement this with decks is yet to be decided. We need to also consider frame animations and how to most easily achieve those in MOAI. | |
]] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment