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 / PlaySprite Problem

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 20th Nov 2014 20:17
Hi.

I wrote a code that when VirtualJoystick Moved to right my and Vice versa.
but there is an Problem that my sprite animation don't work.

Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 20th Nov 2014 20:59 Edited at: 20th Nov 2014 21:03
Try this;

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 20th Nov 2014 21:24 Edited at: 20th Nov 2014 21:25
Thanks Funnell7 work very well.

I have another question that I created sprite like below code and load one sprite sheet that have 11 frame.Now I want add another sprite sheet that when Player move up the ladder change animation. but I don't know how to do it. Please Guide Me.

Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 20th Nov 2014 22:50
Not sure... I don't use Spritesheets, but could you not add all the animation frames to 1 sheet, and then just play the frames relevant to what ever your player is doing...
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Nov 2014 15:13 Edited at: 21st Nov 2014 18:51
I attched my project that have 2 sprite sheet (idle,walk).idle is default animation and I need anyone show me how change animation to walk when VirtualJoystick is moved to right or left.

Thanks.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Nov 2014 18:51
any idea?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Nov 2014 08:34
can anyone help me?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Nov 2014 09:01
Use states to handle switching the texture on the sprite.

Also when posting code/projects please help us so that we can help you.
Your code was hard to read and had some pretty odd things going with syntax of if-then and then a next line with else. It was confusing me and likely confusing you. Clean code with good indents will help you a lot. That and reviewing a book on AGK. Hands On AppGameKit Basic will take you far.

I've fixed your code and added state handling of the sprite's texture to make him walk.


Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Nov 2014 09:43
Thanks Naphier, and sorry for my bad syntax.
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Nov 2014 10:59
No worries. It will help you if you are more structured and clean with your code.

Login to post a reply

Server time is: 2024-11-25 11:29:59
Your offset time is: 2024-11-25 11:29:59