Code: Select all
Procedure decoradoTEST()
Protected.f o
Protected mate,mesh,enti, p
Protected tt3D= CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(tt3D))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,OutputWidth(),OutputHeight(),$ff888888)
Box(0,0,256,4,$ff555555)
Box(0,0,4,256,$ff555555)
For p= 0 To 256 Step 64
Box(p,0,8,32,$ff555555)
Box(0,p,32,8,$ff555555)
LineXY(p,0,p,OutputHeight(),$ff555555)
LineXY(0,p,OutputWidth(),p,$ff555555)
Next p
StopDrawing()
mate= CreateMaterial(#PB_Any,TextureID(tt3D));suelo
mesh= CreatePlane(#PB_Any,20,20,10,10,20,20)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),0,0,0)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
mesh= CreateCube(#PB_Any,1)
BuildMeshLOD(mesh, 1,30,100)
For p= -10 To 9 ;muros
o= Random(15) * 0.02
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),p+0.5,0.5-o,10.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),p+0.5,0.5-o,-10.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),10.5,0.5-o,p+0.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),-10.5,0.5-o,p+0.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
Next p
For p=1 To 10 ;obstaculos
x= Random(19)-10 : While x>-3 And x<3 : x= Random(19)-10 : Wend
y= Random(19)-10 : While y>-3 And y<3 : y= Random(19)-10 : Wend
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),x+0.5,0.5,y+0.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
Next p
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),-1.5,0.02,-1.44)
ScaleEntity(enti,0.9,1,4.5,#PB_Absolute):RotateEntity(enti,12.8,0,0)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),-1.5,0.5,-4)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),-1.5,0,-5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mate),-3.5,0.5,-3.5)
CreateEntityBody(enti,#PB_Entity_StaticBody)
SetEntityCollisionFilter(enti,1<<1,1<<1)
CreateLine3D(#PB_Any, -20,0,0,$0000ff, 20,0,0,$00ffff)
CreateLine3D(#PB_Any, 0,0,-20,$ff0000, 0,0,20,$ffff00)
CreateLine3D(#PB_Any, 0,0,0,$004400, 0,20,0,$00ff00)
CreateLine3D(#PB_Any, -10,0,-10,$004400, -10,20,-10,$ffffff)
EndProcedure
For a large map I think creating groups of entities and when the player approaches show them and hide them when they move away.
But it can be very heavy for the speed, when running so many conditions. Any way, problems one by one hehe.