Knoton
05-31-2006, 09:42 AM
How would I go about using a sprite sheet as an anaimation? Also how can I choose just a section of a long bitmap to place on a surface, I would guess it is effectively the same thing as choosing the area on a sprite sheet to put on a surface. Is there a better way of doing side scrolling? Here's my project so far if it helps. You just need to change the paths to wherever you extract it to.
EDIT: btw I am using directdraw
ben_dover
06-18-2006, 04:32 AM
Hi Knoton, I don't have a clue but I need to learn this for my game also, so if you figure it out can you PM me please and I'll do the same if I figure it out.
ShadowWolf
06-20-2006, 02:45 PM
If your doing what I think you are this should be rather simple, but obviously your not because then you would already have figured it out. Anyways, to draw a part of the surface (if you want to draw a part of a bitmap then load it into a surface first) is to specify the part you want to draw using a RECT (DX7) or System.Drawing.Rectangle (DX9). So when you Blt it would be something like this (just a guess):
With R1 'The source
'Set the source dimensions here
End With
With R2 'The destination
'Obviously this is the size of the backbuffer/screen/rendertarget
End With
bmapSurface.Blt(R1, BackBuffer, R2)
For animations where all images are in one image, do something like this:
'Variables
Dim ImageIndex As Integer =0
'Animation
With R1
.Top = 0
.Left = <one image witdth> * ImageIndex
.Right = .Left + <one image width>
.Bottom = <one image height>
End With
'Do the Blt
I hope that helps.