nSprite does not draw anything...

Blitz3D Forums/Blitz3D Userlibs/nSprite does not draw anything...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Still doesn't draw more than 1 sprite though the sprite conter says there is 3... CONFUSED!!!

; JUST to see if the card thing works... RWD
Graphics3D 800,600,16,2

SetBuffer BackBuffer()
Include "nSprite.bb"

SeedRnd MilliSecs()
reseed = Rand(1,1000) ;this compensates for known Random bug (just ask 'Morduun' 8)
reseed = Rand(1,1000) 

camera=CreateCamera()
PositionEntity camera,0,0,0
light=CreateLight()
RotateEntity light,45,0,0

nS_Initialize() ; initialize nSprite

card = nS_LoadAnimImage("cards.png",71,96,0,51)

Dim cards%(52)

.reshuffle

shuffle()

xx% = 10
yy% = 200

For i% = 1 To 13
	y% = y% + 15

	Text  10, y, getSuit$(cards(i))
	Text 210, y, getSuit$(cards(i+13))
	Text 410, y, getSuit$(cards(i+26))
	Text 610, y, getSuit$(cards(i+39))
	Text 320, 570, "( Press any key to exit )"
Next

Input


Flip

a=nS_DrawImage(card,50,50,cards(1)-1) ; have to subtract 1 to show the real card for some reason
b=nS_DrawImage(card,150,150,cards(2)-1)
c=nS_DrawImage(card,200,200,cards(3)-1) ; but it still won't draw more than 1 sprite

UpdateWorld()
RenderWorld()

Text 0,0,"CARD: "+getsuit$(cards(1))+" + "+getsuit$(cards(2))+" + "+getsuit$(cards(3))
Text 0,20,"RAW #: "+cards(1)
Text 0,40,"SPRITES: "+nS_SpriteCount

Flip
Input 
End

Function shuffle%()
	;Load the cards() array with 52 unique numbers
	;(they just happen to be sequential for now)
	For i% = 0 To 51
		cards(i) = i
	Next

	;Simulate shuffling deck 7 times	
	For i = 1 To 7*51
		;Use indices swap1 and swap2 to scramble deck
		swap1% = Rand(0,51)
		swap2% = Rand(0,51)
		
		;Ensure indices don't point to same element
		While swap1 = swap2
			swap2 = Rand(0,51)
		Wend
		
		;OK, two different elements, perform swap
		temp% = cards(swap1)
		cards(swap1) = cards(swap2)
		cards(swap2) = temp
	Next
End Function

Function getSuit$( integer%)
	;1-13 is a spade,  14-26 is a heart,  27-39 is a club,  40-52 is diamond
	If integer < 14 Then suit$ = "Spades"
	If integer > 13 And integer < 27 Then suit$ = "Hearts"
	If integer > 26 And integer < 40 Then suit$ = "Clubs"
	If integer > 39 Then suit$ = "Diamonds"
	;now we know the suit, make 'integer' a number between 0 and 12
	integer = integer Mod 13
	
	Select integer
		Case  1: value$ = "Ace"
		Case 11: value$ = "Jack"
		Case 12: value$ = "Queen"
		Case  0: value$ = "King"
		Default: value$ = Str(integer)
	End Select
	
	Return value$ + " of " + suit$
End Function
But look at this with blitz using regular blitz3d...
; JUST to see if the card thing works... RWD
Graphics3D 800,600,16,2

SetBuffer BackBuffer()
;Include "nSprite.bb"
SeedRnd MilliSecs()
reseed = Rand(1,1000) ;this compensates for known Random bug (just ask 'Morduun' 8)
reseed = Rand(1,1000) 

camera=CreateCamera()
PositionEntity camera,0,0,0
light=CreateLight()
RotateEntity light,45,0,0

;nS_Initialize() ; initialize nSprite

;card = nS_LoadAnimImage("cards.png",71,96,0,51)
card = LoadAnimImage("cards.png",71,96,0,51)

Dim cards%(51)

;For car = 1 To 52
;cardpic[car] = nS_DrawImage(card,Rand(100),Rand(200),car)
;Next

.reshuffle
Cls

shuffle()


For i% = 0 To 12
	y% = y% + 15

	Text  10, y, getSuit$(cards(i))
	
	DrawImage card,yy,230,cards(i)-1 
									
	Text 210, y, getSuit$(cards(i+13))

	Text 410, y, getSuit$(cards(i+26))

	Text 610, y, getSuit$(cards(i+39))

	Text 320, 570, "( Press any key to exit )"
	yy = yy + 72
Next



WaitKey()

End




Function shuffle%()
	;Load the cards() array with 52 unique numbers
	;(they just happen to be sequential for now)
	For i% = 0 To 51
		cards(i) = i
	Next

	;Simulate shuffling deck 7 times	
	For i = 1 To 7*52
		;Use indices swap1 and swap2 to scramble deck
		swap1% = Rand(0,51)
		swap2% = Rand(0,51)
		
		;Ensure indices don't point to same element
		While swap1 = swap2
			swap2 = Rand(0,51)
		Wend
		
		;OK, two different elements, perform swap
		temp% = cards(swap1)
		cards(swap1) = cards(swap2)
		cards(swap2) = temp
	Next
End Function

Function getSuit$( integer%)
	;1-13 is a spade,  14-26 is a heart,  27-39 is a club,  40-52 is diamond
	If integer < 14 Then suit$ = "Spades"
	If integer > 13 And integer < 27 Then suit$ = "Hearts"
	If integer > 26 And integer < 40 Then suit$ = "Clubs"
	If integer > 39 Then suit$ = "Diamonds"
	;now we know the suit, make 'integer' a number between 0 and 12
	integer = integer Mod 13
	
	Select integer
		Case  1: value$ = "Ace"
		Case 11: value$ = "Jack"
		Case 12: value$ = "Queen"
		Case  0: value$ = "King"
		Default: value$ = Str(integer)
	End Select
	
	Return value$ + " of " + suit$
End Function
What am I doing wrong... I know I am missing something simple but important...