I bought the Bengies sprite pack for use in Dbpro. In the 3d_examplecode thats located in the spritefolder (for us with Dbpro) the script is using 3 diffrent sprites.
demonstrates animated sprites
sync on
sync rate 60
color backdrop 0
make object plain 1, 1, 1
load image "animatedlitsmoke16litsmoke16.png", 1
texture object 1, 1
set object transparency 1, 1
set object light 1, 0
position object 1, -1, 0, 0
make object plain 2, 1, 1
load image "animatedplasmaballside16plasmaballside16.png", 2
texture object 2, 2
set object transparency 2, 1
set object light 2, 0
make object plain 3, 1, 1
load image "animatedplasmaflux16plasmaflux16.png", 3
texture object 3, 3
set object transparency 3, 1
set object light 3, 0
position object 3, 1, 0, 0
position camera 0, 0, -2
iObjectFrame = 1
iLastTime = timer ( )
do
SetTextureFrame( 1, iObjectFrame, 4, 4 )
SetTextureFrame( 2, iObjectFrame, 4, 4 )
SetTextureFrame( 3, iObjectFrame, 4, 4 )
if ( timer ( ) > iLastTime + 30 )
iLastTime = timer ( )
if ( iObjectFrame < 4 * 4 )
iObjectFrame = iObjectFrame + 1
else
iObjectFrame = 1
endif
endif
center text 400, 550, "Example Sprites From Benge's Animated Sprite Pack"
sync
loop
function SetTextureFrame( iObject, iFrame, iFrameAcross, iFrameDown )
fTuSeg# = 1.0 / iFrameAcross
fTvSeg# = 1.0 / iFrameDown
iXTile = iFrame mod iFrameAcross
iYTile = ( iFrameDown - 1 ) - ( ( iFrame - iXTile ) / iFrameAcross )
fTu# = fTuSeg# * iXTile;
fTv# = 1.0 - ( fTvSeg# * iYTile )
lock vertexdata for limb iObject, 0
set vertexdata uv 0, 0, fTu# + fTuSeg#, fTv# - fTvSeg#
set vertexdata uv 1, 0, fTu#, fTv# - fTvSeg#
set vertexdata uv 2, 0, fTu# + fTuSeg#, fTv#
set vertexdata uv 3, 0, fTu#, fTv# - fTvSeg#
set vertexdata uv 4, 0, fTu#, fTv#
set vertexdata uv 5, 0, fTu# + fTuSeg#, fTv#
unlock vertexdata
endfunction
since i only use one sprite in my game i erased this part
make object plain 1, 1, 1
load image "animatedlitsmoke16litsmoke16.png", 1
texture object 1, 1
set object transparency 1, 1
set object light 1, 0
position object 1, -1, 0, 0
make object plain 2, 1, 1
load image "animatedplasmaballside16plasmaballside16.png", 2
texture object 2, 2
set object transparency 2, 1
set object light 2, 0
Once i run the code in my game sprite looks like this (picture), it do play the way i should but it kind of look splitet in half. Why? something wrong with the vertexdata?
Greatful for all help
Hello!