Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] playSprite how to play certain frames at different sprite states

Author
Message
jsheedy
5
Years of Service
User Offline
Joined: 29th Aug 2018
Location:
Posted: 11th Oct 2019 21:59 Edited at: 11th Oct 2019 22:01
I am having an issue understanding how to get playsprite working when I want to use certain frames for sprite death. frames 1-4 regular animation (loop), 5-8 sprite death(play once through). I am sure that my function is really wrong, but I am just going with what I know as of now.

What i want to happen.
sprites move across screen and animations 1-4 play (loop). This works fine.
a player kills sprite - then play animation 5 - 8, (noloop)
when when sprite resets it goes back to frames 1-4
I could get it to work if I ran a small repeat until loop with a sync(), but that was plain ugly.



Media load section


sprite hit/score/reset function

Josh

The author of this post has marked a post as an answer.

Go to answer

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Oct 2019 05:08
This post has been marked by the post author as the answer.
When you change the animation sequence using playSprite(), you have to first manually specify a starting frame using setSpriteFrame() otherwise it'll run through all frames until it reaches the target range you set.

setSpriteFrame(mySprite, 5)
PlaySprite( mySprite, 20, 0, 5, 8 )

Without setting the frame, you could see your sprite animate from 1 to 8 instead of 5 to 8.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
jsheedy
5
Years of Service
User Offline
Joined: 29th Aug 2018
Location:
Posted: 23rd Oct 2019 19:20
Thanks Phaelax!

I did end of somewhat figuring it out. I don't think it is the most efficient, and I plan on reviewing it further, but I can at least say it is doing what I want it to do currently.


//check for hit function.


//play_pumpkins function

Josh

Login to post a reply

Server time is: 2024-04-23 10:45:13
Your offset time is: 2024-04-23 10:45:13