D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation
D3D Sprite Animation D3D Sprite Animation
D3D Sprite Animation
Go Back  Xtreme Visual Basic Talk > > > > D3D Sprite Animation


Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2008, 08:55 AM
cruzcoda cruzcoda is offline
Newcomer
 
Join Date: Mar 2008
Posts: 1
Default D3D Sprite Animation


Hi,

I'm working on a section of my gaming code that handles sprites requiring animation. For the animation itself, I'm using a 'film-strip' styled bmp image that is 768w by 64h, with each frame being 64 wide.

In the code, I'm defining my source rectangle with the x value set to frame number * 64.

My problem then is that the animation 'floats', rolling across the sprite instead of being centered.

I'm wondering if it's a problem with my image itself, or if the source rectangle is causing a problem.

Misc. Info:

Timer.Tick event increments the frame number every 100ms.
sprite position is currently set for 0,0
when the source rectangle is set to encompass the whole image, there is no unusual stretching or scaling issues.
source image is being pulled as an embedded source into a texture.

Any help with this would be great. Thanks.
Reply With Quote
  #2  
Old 04-05-2008, 02:22 AM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

I guess its rolling across by 1, what you have to do is increase that by 64, (obviously)
without seeing your counting loop it's difficult to advise you....
...somewhere you have set something like X=X+1, change the 1 to 64 and you should be fine.
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation D3D Sprite Animation
D3D Sprite Animation
D3D Sprite Animation
 
D3D Sprite Animation
D3D Sprite Animation
 
-->