SyntaxBoom

Languages & Coding => BlitzBasic (Plus/3D variants) => Code Archive => Topic started by: 3dzForMeStill on Jun 13, 2025, 12:53 AM

Title: Blitz3D Cube Fun
Post by: 3dzForMeStill on Jun 13, 2025, 12:53 AM

; Some nice Blitz3D code  :o

; Turning a cube into a wall
; use walls to create maps :)
; CREDITING Paks for original cube spinny code.......
; https://github.com/Pakz001/Blitz3d/blob/master/CreateCube%20to%20Wall.bb

Graphics3D 640,480
SetBuffer BackBuffer()



Global ang
Global wall

wall = CreateCube()
ScaleEntity wall,1,1,0.05
PositionEntity wall,x,y,0
ang=0

cam = CreateCamera()
MoveEntity cam, 0,0,-4


While KeyDown(1) = False
   ang=ang+1
   If ang>359 Then ang=0
   RotateEntity wall,0,ang,0
   RenderWorld
   Flip
   
   ; moving it aobut a bit...........
   If X<300
      X=X+1
      MoveEntity wall,0.05,0,0
   EndIf
   
   If X=300
      MoveEntity wall,-0.15,0,0
      X=0
   EndIf
   
Wend

End
Title: Re: Blitz3D Cube Fun
Post by: 3dzForMeStill on Jun 13, 2025, 12:01 PM
;Now with moving camera!!!!

; Turning a cube into a wall
; use walls to create maps :)
; CREDITING Paks for original cube spinny code.......
; https://github.com/Pakz001/Blitz3d/blob/master/CreateCube%20to%20Wall.bb

;v2 with receding camera on a counter

Graphics3D 800,600
SetBuffer BackBuffer()



Global ang
Global wall

wall = CreateCube()
ScaleEntity wall,1,1,0.05
PositionEntity wall,x,y,0
ang=0

cam = CreateCamera()
MoveEntity cam, 0,0,-4


While KeyDown(1) = False
   
   
   counter=counter+1
   
   ang=ang+1
   If ang>359 Then ang=0
   RotateEntity wall,0,ang,0
   RenderWorld
   ;Flip
   
   ; moving it aobut a bit...........
   If X<300
      X=X+1
      MoveEntity wall,0.05,0,0
   EndIf
   
   If X=300
      MoveEntity wall,-0.15,0,0
      X=0
   EndIf
   
   If counter=100 Then
      maxcounter=maxcounter+1
      counter=0
      MoveEntity cam,0,0,-1
   EndIf
   
   
   
   Text 20,20,"counter"
   Text 120+(maxcounter*20),20,maxcounter
   
   Flip
   
Wend

End