Hello i have been trying to scale sprite animations but i cannot seem to find any resources online that lead to decreasing the sprite animations. To decrease the animations image size i would have to manually go to decrease the size in Photoshop is there a line of code like :scale(x,y) like regular image rendering ?
What is the code that you are currently using? I scale my imagesheet objects often with both the .xScale/yScale and :scale() APIs. If you can post what you have so far, it would help to resolve your issue.
This is a snnipet of the code that i use to animate the sprite sheet:
AttrAnimList[ANIM_TYPE.RUNNING] =
{
sheet = graphics.newImageSheet( “images/NPC_running.png”, {width = 410,height = 332,numFrames = 10} ),
sequence =
{
{name=“npc-running”,start= 1,count =10,time = 500,loopCount = 0, loopDirection = “forward”}
},
}
this above script is in another file where all animations are in there and i will call the needed animation in each scene
the script below is where i call the animation to a local variable and set it to play
local AttrAnim = require(“AttrAnimList”)
running=display.newSprite( AttrAnim[ANIM_TYPE.RUNNING].sheet, AttrAnim[ANIM_TYPE.RUNNING].sequence )
running:setSequence( “npc-running” )
running:play( )
from here i cannot set running:scale(0.2,0.2) it just does not work.
thank you for your help!
hello i have solved it on my own sorry for the wasted resources i called the scale on another part of my condition that is not calling it thanks you for your help and effort!
What is the code that you are currently using? I scale my imagesheet objects often with both the .xScale/yScale and :scale() APIs. If you can post what you have so far, it would help to resolve your issue.
This is a snnipet of the code that i use to animate the sprite sheet:
AttrAnimList[ANIM_TYPE.RUNNING] =
{
sheet = graphics.newImageSheet( “images/NPC_running.png”, {width = 410,height = 332,numFrames = 10} ),
sequence =
{
{name=“npc-running”,start= 1,count =10,time = 500,loopCount = 0, loopDirection = “forward”}
},
}
this above script is in another file where all animations are in there and i will call the needed animation in each scene
the script below is where i call the animation to a local variable and set it to play
local AttrAnim = require(“AttrAnimList”)
running=display.newSprite( AttrAnim[ANIM_TYPE.RUNNING].sheet, AttrAnim[ANIM_TYPE.RUNNING].sequence )
running:setSequence( “npc-running” )
running:play( )
from here i cannot set running:scale(0.2,0.2) it just does not work.
thank you for your help!
hello i have solved it on my own sorry for the wasted resources i called the scale on another part of my condition that is not calling it thanks you for your help and effort!