I have an animated character running and jumping.
I made the spritesheet with the old spritesheet api.
When the character runs (background moves, character remains in same position), the running animation plays allright, but when it jumps, it only plays the first frame of the sequence.
I tought i had declared wrong the jumping animation, but if a change the walking for the jumping (character jumps when moving forward, walks when jumping), the jumping animation plays allright.
Is there any problem when playing a sprite sequence AND changing it’s x and y values?
Any help will be appreciated!
Thanks!
[import]uid: 105206 topic_id: 24252 reply_id: 324252[/import]
I have spritesheets (old api) changing x and y value. No problem here! Do you have a code snippet? [import]uid: 90610 topic_id: 24252 reply_id: 97993[/import]
The x and y values are changed on enterFrame basis by hero.x and hero.y
Here i declare the animation:
[blockcode]
local moe = require “moe”
local moeData = moe.getSpriteSheetData()
local moeSheet = sprite.newSpriteSheetFromData( “moe.png”, moeData )
local moeSet = sprite.newSpriteSet(moeSheet, 1, 25)
sprite.add(moeSet, “jump”, 1, 7, 400, 1)
sprite.add(moeSet, “walk”, 8, 10, 650, 0)
sprite.add(moeSet, “death”, 18, 9, 400, 1)
[/blockcode]
Here i choose which animation to use:
[blockcode]
if(onGround) then
if(wasOnGround) then
else
hero:prepare(“walk”)
hero:play()
onGround=true
end
else
hero:prepare(“jump”)
hero:play()
onGround=false
end
[/blockcode] [import]uid: 105206 topic_id: 24252 reply_id: 98015[/import]
PROBLEM SOLVED! NEVERMIND! [import]uid: 105206 topic_id: 24252 reply_id: 98243[/import]
I just wanted to write you that I was using the old spritesheets with the new api… glad that you solved it! [import]uid: 90610 topic_id: 24252 reply_id: 98245[/import]