smaller code

Blitz3D Forums/Blitz3D Programming/smaller code

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.

Graphics3D 800,600,0,2

cam=CreateCamera()
CameraZoom cam,1.6
PositionEntity cam,-65,2,-55

cubeY=20
Dim cube#(7)

For i=0 To 7
	cube#(i)=CreateCube()
	PositionEntity cube#(i),-65,cubeY-(5*i),-10
	ScaleEntity cube#(i),1.5,1.5,1.5
	EntityColor cube#(i),Rand(0,255),Rand(0,255),Rand(0,255)
	EntityPickMode cube#(i),2
	NameEntity cube#(i),"cube no."+(i+1)
Next

Repeat
	If MouseHit(1):MoveEntity cube#(1),1,0,0:MoveEntity cube#(7),-1,0,0:EndIf  ;LMB(move second and last box)
	CameraPick(cam,MouseX(),MouseY())
	If PickedEntity() > 0
		name$ = EntityName( PickedEntity() )
	Else
		name$=""
	EndIf
	RenderWorld
	Text 10,180,name$
	Flip
Until KeyHit(1)
End


edit: to speed things a little bit up you could also use copyentity instead of creating new cubes...