Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deesaster committed Mar 5, 2012
0 parents commit 4b7f17f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
Binary file added SpriteSheet/assets/images/ptero_fly_anim.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions SpriteSheet/build.settings
@@ -0,0 +1,10 @@
-- Supported values for orientation:
-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {

orientation = {
default = "portrait",
supported = { "portrait", }
},
}
14 changes: 14 additions & 0 deletions SpriteSheet/config.lua
@@ -0,0 +1,14 @@
application = {
content = {
width = 320,
height = 480,
scale = "letterBox",
fps = 30,

--[[
imageSuffix = {
["@2x"] = 2,
}
--]]
}
}
39 changes: 39 additions & 0 deletions SpriteSheet/main.lua
@@ -0,0 +1,39 @@
--load sprite module
local sprite = require( "sprite" )

-- load spritesheet image
-- 1st parameter is a path to the image file
-- 2nd frame width
-- 3rd frame height
local pteroSheet = sprite.newSpriteSheet( "assets/images/ptero_fly_anim.png", 252, 120 )

-- create a spriteset
-- 1st parameter is the spritesheet we just created,
-- 2nd is the number of the first frame
-- 3rd is the total nmber of frames in the animation
local pteroSet = sprite.newSpriteSet( pteroSheet, 1, 6 )

-- add spriteset to the sprite module, so that we can instanciate it later
-- 1st param is the spriteset we created above
-- 2nd - a name for our animation (we'll use it to create an instance later)
-- 3rd - start frame
-- 4th - number of frames
-- 5th - time in millis for a full animation
-- 6th - number of loops to play, -2 is for continuous looping
sprite.add( pteroSet, "ptero", 1, 6, 300, -2 )

--create white background
local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
background:setFillColor( 255 )

--create an instance of our animated sprite
local ptero = sprite.newSprite( pteroSet )

--center it on screen
ptero:setReferencePoint( display.CenterReferencePoint )
ptero.x = display.contentWidth / 2
ptero.y = display.contentHeight / 2

-- start animating
ptero:prepare( "ptero" )
ptero:play()

0 comments on commit 4b7f17f

Please sign in to comment.