Forum Archive

Scene module animated spriteNode

Drizzel

Hey guys,
So, im creating a little game at the moment, and I'm trying to have a character walking over the screen. My issue is that I cannot get the walking animation to run. Let's say I have this array of all of the imageNames of my animation sequence Images = ['Walking1.png', 'Walking2.png', 'Walking3.png'], how do I get them to show in order as a walking animation that can still be navigated around the screen with commands like self.WalkingAnimation.run_action(Action.move_to(400, 300, 5)?

I tried using a gif as a spriteNode, which only showed the very first 'image' of the gif, and the gif was definitely imported correctly
Anyone has any idea how to fix this?
Thanks a lot,
Drizzel

JonB

If you go to the Examples/Game Tutorial folder in your pythonista library, you will find a fully worked example game, from start to finish.

The tutotial part 3 covers exactly this topic.

Drizzel

Yeah that's how I learned just about everything I know. The sprites in themselves are still sprites, consisting only of a singe image, and I was wondering how to have a character with for example moving legs when he walks around

JonB

You have to cycle the texture, just like in tutorial 3. You simulate moving legs by cycling through a sequence of static images. In the tutorial, whenever the sprite moved 40 pixels, the texture changed.

Alternatively. you could have separate sprites for the legs, and use actions to rotate/pivot the legs.

Drizzel

Awesome, it finally works :D