Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to make multiple animation for an object by multiple image in Corona SDK?
Started by votrongtin882003 May 18 2019 12:28 AM

1 reply to this topic
corona animation sprite-sheet
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

votrongtin882003

[GLOBAL: userInfoPane.html]
votrongtin882003
  • Observer

  • 2 posts
  • Corona SDK

0
 

 

I just learned programming with Corona SDK. Recently I have a problem in animate the object. I have seen all the instructions about animation in corona and I saw it just present about how to make animation for object with a single image( they use one image to make the object have two or more animation) https://www.youtube.com/watch?v=VsA2agBAWho&t=322s .

I have followed suit and the problem begin when I find the asset on the Internet, the link here: https://finalbossblues.itch.io/pixel-platformer-pack?download . As you can see, the folder have multiple image for multiple animation. I have no idea and no reference to animate all the animation for my player by multiple image( but I can do that with a single image).

I have found all the way to solve them on the Internet but there no result suitable for me. :((

As the result, i have a dump and poor code:

-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------

-- My code here

local sheetData = {
width = 30,
height = 44,
numFrames = 6,
sheetContentWidth = 181,
sheetContentHeight = 44 }

local mySheet = graphics.newImageSheet( "walk.png", sheetData )

local sequenceData = {
{ name = "normalrun", start = 1, count = 6, time = 800 }
}

local animation = display.newSprite( mySheet, sequenceData )
animation.x=150
animation.y= 300
animation:play()

just make 1 animation :((

And now, I just have two ways to choose. One is use some method to animate multiple animation by multiple image ( You will help me in this side, I really need your help!). Two is combine all image to one :)) ( look so cheat ).

Thank you a lot to help me and so sorry because my English is not good, I am Vietnamese I use GG Translate. This is my first step in game development and I dont want to be defeated. I want to integrated all animation into my player( like walk, jump, attack...) and call it to use when I want ( with multiple Image). Please sympathize with me because I was asking so stupid.

Thanks you so much. Hope there will be a way to help me :)) It will be more good if you show me the example.

 



[TOPIC: post.html]
#2

Quitalizner

[GLOBAL: userInfoPane.html]
Quitalizner
  • Enthusiast

  • 45 posts
  • Corona SDK

Hi,

 

From what I understand from your question. You probably would want to look at a spritesheet tool.

You can even find them online. For example https://www.leshylabs.com/apps/sstool/. This takes you to leshy spritesheet tool.

 

What you would want to do is drag all the individual images to the leshy tool in your browser. This generates a spritesheet( all images combined in a single compact image).

 

Next step, just look at documentation for multiple sequence in animating the sprites to get different animation from same spritesheet.

https://docs.coronalabs.com/guide/media/spriteAnimation/index.html#multiple-sequences

 

For example from the above code you have provided:-

local sequenceData = {

      { name = "normalrun", start = 1, count = 6, time = 800 }
      { name = "fastrun", frames = {2,3,4,1}, time = 800 }
      { name = "jump", frames = {2,2,3}, time = 300 }

}



[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: corona, animation, sprite-sheet