Kitaiko
01-10-2002, 05:03 AM
In this program how would i make more of the pink plant to the top left. I did not write this code, but i modified it, and i am not kitaiko, i am chris1234 but my acount wont work. Soz i gotta go i am in a hurry. bye:confused:
Kitaiko
01-10-2002, 10:08 PM
Thanks for all your help!
Squirm
01-11-2002, 04:05 AM
Thanks for being so impatient, but what do you expect when posting in the wrong forum? :mad:
You just need to alter the position of the DstRect and then Blt again to add another 'plant'. In this example, I have set up a simple nested loop that adds SPRITEWIDTH to the rect properties each time, and produces a tile of plants 4x4 wide:
Dim i As Long
Dim j As Long
For i = 0 To (SPRITEWIDTH * 4) Step SPRITEWIDTH
For j = 0 To (SPRITEHEIGHT * 4) Step SPRITEHEIGHT
With DstRect
.Left = i
.Right = i + SPRITEWIDTH
.Top = j
.Bottom = j + SPRITEHEIGHT
End With
ddResult = BackBufferSurface.Blt(DstRect, SpriteSurface, SrcRect, DDBLT_WAIT Or DDBLT_KEYSRC)
If ddResult Then ShowError (ddResult)
Next j
Next i
Or, alternatively, just use the (faster) BltFast call:
Dim i As Long
Dim j As Long
For i = 0 To (SPRITEWIDTH * 4) Step SPRITEWIDTH
For j = 0 To (SPRITEHEIGHT * 4) Step SPRITEHEIGHT
ddResult = BackBufferSurface.BltFast(i, j, SpriteSurface, SrcRect, DDBLTFAST_SRCCOLORKEY Or DDBLTFAST_WAIT)
If ddResult Then ShowError (ddResult)
Next j
Next i
Is that helpful enough for you?
Kitaiko
01-11-2002, 10:29 PM
Calm down buddy, i waz only kidding.
The reason i put it in this one is cause im using it to make a game and i have this site in my favourites, so when i go to it it automatically goes to the games section, so i just posted it here.
Ne way thanks for your help i'll try your suggestion.
Kitaiko
01-11-2002, 10:46 PM
Well done, this is the first snipet of code from this site that has actually worked, good job! Thanks alot!