Animated Sprite starting midway through animation

Hey y'all! I have so enjoyed owning a Playdate and experiencing so many games that the community here has made over the last few months. I just started designing my own, currently titled 'Horrified Hector,' a spooky/ice maze style game.

I'm trying to set up an opening "cutscene" of sorts, so that when you step on a tile in the first level, a ghost appears before you. I have an animated sprite, "ghostappear," that is set to be swapped in for a blank tile when you walk over a specific spot on the level.

on collect do
tell 16,11 to
swap "tile 169"
end
tell 19,11 to
swap "ghostappear"
once "ghostappearsong" then
loop "run"
end
end
end

The sprite comes in fine, however because it's a 9-frame animation, it sometimes starts in the middle. I assume this is because it's already running in the background and is made visible whenever I step on that specific spot. Is there an easy way to start the animation from the beginning on collect?

Thanks in advance for any help., new to this whole thing!

Best,
Alex

Yes there is, you can use play instead of swap to a tile that plays the entire animation from the start.

1 Like

Ah! Perfect, thank you!

im trying to trigger a series of tiles to play during the Fin message of the game, and i have the location of the dialog box correct, but cant seem to correctly implement a playing tile (only four frames).

the goal is to have a Fin dialog box, single play through of a sound and several tiles to play while the dialog box appears.

any ideas how to organize this?

thank you!

It's not possible to do that with fin because it clears the entire screen and say stops all animated tiles on screen.

What you could do is have it so when you meet the requisites for the fin message, say:

if ____ then
goto "endscreen"

Then on your new "endscreen",
You can have it display some text using tiles, and play an animation. You can just do something like this in the endscreen code:

On enter do
Tell 7,10 to
Play "enddance1"
Tell 8,10 to
Play "enddance2"
Tell 7,11 to
Play "enddance3"
Tell 8,11 to
Play "enddance4"
End
End
End
End

Wait 5 then
Fin

That may be sloppy, I'm in transit at the moment, but should give you a starting path.

Best,
Alex

1 Like

This is a good idea! I will try and see what I can come up with. Thanks!