Here is a code that I have. Now, I want the sprite box to be rendered between the red sphere and yellow cube. Red Sphere is closer to the camera, then the sprite in the middle, then the yellow box. Can someone look at the code, and update it to make that work? Thanks.
I do want to use Blitz2D commands though.
P.S. Use arrow keys to move the sprite between the 3d objects.
Graphics3D 800,600,32
gvCamera = CreateCamera()
gvIsDone = 0
lvCube = CreateCube()
EntityColor lvCube,255,255,0
MoveEntity lvCube,1,0,8
EntityFX lvCube,1
lvSphere = CreateSphere()
EntityColor lvSphere,128,0,64
MoveEntity lvSphere,-1,0,4
EntityFX lvSphere,1
lvTexture = CreateTexture(64,64)
SeedRnd MilliSecs()
SetBuffer TextureBuffer(lvTexture)
For x=0 To 63
For y=0 To 63
Color Rand(0,255),Rand(0,255),Rand(0,255)
Plot x,y
Next
Next
lvSprite = CreateImage(50,50)
SetBuffer ImageBuffer(lvSprite)
For x=0 To 49
For y=0 To 49
Color Rand(0,100),Rand(0,255),Rand(0,255)
Plot x,y
Next
Next
EntityTexture lvCube,lvTexture
EntityTexture lvSphere,lvTexture
imgX = 0
imgY = 300
CameraClsMode gvCamera,0,1
SetBuffer BackBuffer()
While gvIsDone = 0
Cls
DrawImage lvSprite,imgX,imgY
UpdateWorld
RenderWorld
TurnEntity lvCube,0,0.1,0
TurnEntity lvSphere,0,-0.1,0
If KeyDown(205) Then imgX = imgX + 2
If KeyDown(203) Then imgX = imgX - 2
If KeyHit(1) Then gvIsDone = 1
Flip
Wend
|