How to...
How do I make a sprite change frames by the number of times dink hits the sprite
sp_pframe(sprite, frame) will change the frame, so you just need to add a variable that keeps count of how many times you hit it.
//for example void hit (void) { &counter += 1; if (&counter >= 5) { sp_pframe(¤t_sprite, 3); } if (&counter >= 10) { sp_pframe(¤t_sprite, 7); } //etc etc etc etc etc }
Make sure the sprite isn't an animated sprite to start with though, if that's what you're going for.
Also, Sparrow's script will eventually not work anymore when the sprite runs out of frames. You would have to reset it to 1 at some point
Also, Sparrow's script will eventually not work anymore when the sprite runs out of frames. You would have to reset it to 1 at some point

@Kyle
It does not!As long as you don't set it to a frame that doesn't exist. It sets the sp_pframe to a specific value when the variable is more (or equal to) an value. What you are thinking about kyle would be something like:
which would stop working when &counter is more than the number of frames in the seq, and could be fixed with a
@Sparrowhawks:
Wouldn't that make the sprite flicker between frames, if even only for a so short time that it's impossible to see? Wouldn't it be better to write:
It does not!As long as you don't set it to a frame that doesn't exist. It sets the sp_pframe to a specific value when the variable is more (or equal to) an value. What you are thinking about kyle would be something like:
void main(void) { int &counter; } void hit(void) { &counter += 1; sp_pframe(¤t_sprite, &counter); }
which would stop working when &counter is more than the number of frames in the seq, and could be fixed with a
if(&counter == 10) &counter = 1;between &counter += 1 and sp_pframe.
@Sparrowhawks:
Wouldn't that make the sprite flicker between frames, if even only for a so short time that it's impossible to see? Wouldn't it be better to write:
. . . if(&counter >= 5) { if(&counter < 10) { //desired frame here. } } . . .