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.

Newcomers DBPro Corner / 8 Way Animated Sprites

Author
Message
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 24th Mar 2010 23:27 Edited at: 24th Mar 2010 23:31
Thanks to some earlier help and code i have control via mouse using point n click to move spites around the screen, i have now tried to add 8 way movement/animation to the code but it's not working to well.
Sometimes no animation palys and sometimes its the wrong animation.
I've attatched the Sprite Sheet (Sprites From http://reinerstileset.4players.de/englisch.html)

[URL=http://s508.photobucket.com/albums/s329/tonycrew/?action=view¤t=OgreWALK01.png][/URL]



FPS Creator Updated 116 + Loads of Addon Packs DBPro DarkAI,eXtends,Dark Physics, Dark Lights
1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU

Attachments

Login to view attachments
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Mar 2010 03:30
Try to use Set Sprite Frame instead and keep track of the frame count with your own variables. You also only need 1 Sync at the end of the loop.
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 25th Mar 2010 10:59
Hi thankyou very much for your replyit works perfectly.
Can i just ask you to explain these a little to me so that i understand this fully.

Quote: "
a = int(angle)/40
if a = 0 then Direct = 0
if a = -2 then Direct = 1
if a = -1 then Direct = 2
if a = -3 then Direct = 3
if a = 2 then Direct = 4
if a = 1 then Direct = 5
if a = 3 then Direct = 6
if a = 4 then Direct = 7
"


Where does the /40 come from...? sorry if this is a daft question, i am just trying to understand so that i have learned something.
And the a = 0 and so on what is this relative to..? is it relative to the X,Y of the sprite or the mouse X,Y.

FPS Creator Updated 116 + Loads of Addon Packs DBPro DarkAI,eXtends,Dark Physics, Dark Lights
1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Mar 2010 15:37 Edited at: 25th Mar 2010 15:39
Quote: "Where does the /40 come from...?"


I think it should be 45 not 40 - 360º divided by 8 (the number of directions).

So, regardless of the angle the character is currently at, it can be reduced to one of the 8 direction values 0 to 7.

You also get the same results with:

A = angle/40

Removing the unwanted INT() function is one less thing the program has to calculate and therefore one less thing to slow it down.

TDK

tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 25th Mar 2010 19:40
Ok thanks for the help i am now beginning to understand this alot better now.

FPS Creator Updated 116 + Loads of Addon Packs DBPro DarkAI,eXtends,Dark Physics, Dark Lights
1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Mar 2010 20:43
Quote: "Removing the unwanted INT()"

That's right, the int() was not needed as A is already an integer.

Quote: "I think it should be 45 not 40 - 360º divided by 8 (the number of directions)."

I first thought that also but for some reason it wasn't working out. I cant figure it out either so I just bumped it up to divided by 9 (40).

Quote: "And the a = 0 and so on what is this relative to..? is it relative to the X,Y of the sprite or the mouse X,Y."

That's related to the angle of the character(X,Y) and the mouse (GoalX,GoalY) to determine witch row of animation frames to use.

Login to post a reply

Server time is: 2024-11-24 17:22:57
Your offset time is: 2024-11-24 17:22:57