Page 1 of 1

Simplest way to swap sprite flames?

Posted: Wed Apr 13, 2016 6:52 am
by POLYGAMe
The sprite engine animation is overkill for what I need. I just want to swap the image of my sprite when I press a joystick direction. What's the best way to do this? Which function should I be calling? I haven't been able to work it out from the docs. Sorry for the super noob question!

Re: Simplest way to swap sprite flames?

Posted: Wed Apr 13, 2016 8:02 am
by Stef
Try to use the VDP_setSpriteXXX(...) methods, they allow you to manipulate sprites at low level :)

Re: Simplest way to swap sprite flames?

Posted: Wed Apr 13, 2016 10:22 am
by POLYGAMe
Cool. I thought that might be slower, like setting your tile map every frame instead of scrolling. I guess im just getting used to how the VDP works. I'll have a play on the weekend. Thanks for your help again!

Re: Simplest way to swap sprite flames?

Posted: Sun Apr 24, 2016 5:56 am
by POLYGAMe
I can't work it out... I can't see in any of those functions where I can change the tile index of my sprite sheet to change frame...

EDIT: I worked out how to do it with SetFrame.

I was looking in the sprite project and I understand how the animations work (how it runs through each row as an animation and you change rows to switch animations) but I couldn't find where the actual animations are set up... sequence, speed etc... it's not in the source file so is it maybe the default settiong in the sprite engine itself?

Re: Simplest way to swap sprite flames?

Posted: Sun Apr 24, 2016 8:01 am
by Stef
I though you didn't wanted to use the Sprite Engine ?
If you use the low level VDP_setSpritexxx methods you don't have direct way of giving the frame to display... you have to deal with that yourself by modifying the attributs of your sprite.
In the Sprite Engine you indeed have a setFrame method for that.

Re: Simplest way to swap sprite flames?

Posted: Mon Apr 25, 2016 12:18 am
by POLYGAMe
Yeah I decided I'd use the engine as some objects will require more animation. I'm struggling to see how to use animations in the sprite demo. I see where they're defined but not how they're implemented. I can write my own using timers and SetFrame etc but I just wasn't sure if that was the 'proper' way. As I said I can't see in the sprite demo how the frames or speed of the Sonic sprite are done...

So yeah I have it working now just wondering if there's a simpler way like plugging in the sequence frames and speed or do I need to code my own system to do that instead of the hard coding I'm using now?

Re: Simplest way to swap sprite flames?

Posted: Mon Apr 25, 2016 9:35 am
by Stef
Currently rescomp handle animation in a very simple way. You have to display each frame inside the sprite sheet, if you have duplicated frames rescomp should detect them and generate the "sequence" array according... About the timer, that is the last parameter in the SPRITE resource definition, i believe i used '5' in the "sprite" demo so each frame is automatically maintained 5 frames before going to the next one.
Again that is very basic, i really need a more advanced tools as the underlying Sprite structures and the Sprite Engine are very flexible but rescomp use them in a very limited way.

Re: Simplest way to swap sprite flames?

Posted: Mon Apr 25, 2016 9:51 am
by POLYGAMe
Ah, got it! Thanks :) For my player I just need SetFrame but I'll need full animation soon. Thanks!