Forums

OverviewV-Play 1 SupportChange Sprite's "loop" property at runtime? › Reply To: Change Sprite's "loop" property at runtime?

OverviewV-Play 1 SupportChange Sprite's "loop" property at runtime? › Reply To: Change Sprite's "loop" property at runtime?
#6063

Alex
V-Play Team

Hi Chrisu,

can you explain me a little further how your animation is supposed to look? Or give me a code example?

In our SpriteSheetTexturePackerExample we are changing the sprites with the jumpTo(…) function like this:

SpriteSequenceFromFile {
  id: squabySprite
  filename: "img/squaby-sd.json"
  anchors.centerIn: parent

  Sprite {
    name: "walk"
    frameNames: ["squ1-walk-1.png", "squ1-walk-2.png", "squ1-walk-3.png", "squ1-walk-4.png"]
    frameRate: 20
  }
  Sprite {
    name: "jump"
    frameNames: ["squ1-jump-1.png", "squ1-jump-2.png", "squ1-jump-3.png", "squ1-jump-4.png"]
    to: "walk"
    frameRate: 10
  }
}

MouseArea {
  anchors.fill: squabySprite
  onClicked: {
    squabySprite.jumpTo("jump")
  }
}

So the squaby is walking until you click it, then it performs a jump and the to property switches back to walking after the jump was performed. Can you achieve your desired animation with this approach?

Cheers,
Alex

 

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support