Post

 Resources 

Console

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 dxgame engine help w/animation

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
jonwang Posted - Dec 07 2006 : 4:42:59 PM
hi,
I am working on a 2d game using the dxgame engine v. dxg231.
While the dxgame forum is down, can anyone here tell me how to set up a simple sprite animation sequence using dxg? That way I can get the tires on my car to look like they are rolling

here is a pic of the game in progress I am working on...




3   L A T E S T    R E P L I E S    (Newest First)
TheTuna Posted - Dec 20 2006 : 11:53:58 AM
I'll second that... Dave, you just worry about family. We'll be here...

ps. I'm very glad to be making contact with SOMEONE from the old forum though! I've missed all the good times!

Tuna
jonwang Posted - Dec 09 2006 : 10:30:24 AM
Thank you dave. All of us dxg users know you are going through a lot right now, so don't be sorry for any delays. You have a lot of friends out here who just hope you make it through everything ok.
dxgame Posted - Dec 09 2006 : 02:13:34 AM
There are a few ways to init your animations, this one can be done directly in code without using an external file.

DX.SpriteAnimate.Add Index, SrcX, SrcY, FrameWidth, FrameHeight, AnimLength, Frame$, Texture$

Index - Which animation index to setup. Start at 1 and proceed upward.

SrcX,SrcY - This is the topleft pixel where the animation image data starts on the texture. Remember to leave a 1 pixel border to the right and at the bottom in between each frame.

FrameWidth, FrameHeight - How wide/tall each animation frame is. Do NOT include the border pixel.

AnimLength - How many frames of animation.

Frame$ - A string representing each grid location for each frame of the animation. This is not in pixels. This allows you to set up complex animations using a combination of horizontal or vertical strips. Each pair of numbers represents where the frame is, horzontal/vertical.

For example, if you had 2 frames of animation next to each other on a horizontal plane the string would simply be: "0,0,1,0". If you had 4 frames it would be "0,0,1,0,2,0,3,0". Notice how the horizontal grid is incremented for every frame but the vertical grid does not. Lets say you had 9 frames arranged in a 3x3 grid pattern, the frame data would be defined as this:

"0,0,1,0,2,0,0,1,1,1,2,1,0,2,1,2,2,2"

Note that the frame numbers stay the same REGARDLESS where on the texture the animation data starts.

Texture$ - This string simply holds the texture index for each frame of the animation. This allows you if desired, to create animations from several loaded textures. But for ease of use, try to keep all of your animations on 1 texture. Each string value represents 1 frame of the animation. So if you had 6 frames of animation, and each frame of the animation was on texture 1 it would look like this:

"1,1,1,1,1,1"

It all quickly makes sense once you start playing with it. ;)

To start a sprite using a looping animation, use this:

DX.SpriteAnimate.Repeat Sprite, AnimIndexAsLong, AnimSpeedAsSingle

AnimIndex - The previously set up anim index number.

AnimSpeed - The speed of the animation. A floating point number. Play around with values such as, .005, .05, .1, etc. The higher the number, the faster the animation will play.

Sorry for the delays at the DXG site. As unbelievable as it sounds, after experiencing my Mother's death recently, my Wife's Father just passed away yesterday. I'll be glad when 2006 is over to say the least. :(

VBGamer © Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.