Hi again. It seems that if I add a delay after myengine.start it loads up all the blocks but still gives me an error on
SuperStrict
Framework _3Impact.Lib
Import brl.linkedlist
If Not i3ImpactOpen() RuntimeError "Unable to initialize the 3Impact game engine"
If Not i3ImpactSettings(_ISETTINGS(640,480,32,False,True)) RuntimeError "3Impact settings failed"
Local myEngine:bmx_3IEngine=New bmx_3IEngine
Global CubeArray:Int[8, 8]
Local Ddata:Int
For Local yiter:Int = 0 Until 8
For Local xiter:Int = 0 Until 8
ReadData Ddata
CubeArray[xiter, yiter] = Ddata
Next
Next
Type THolderBlock
Field x:Int
Field y:Int
Field rot:Float
Field FMesh:MESH
Field FBody:BODY
Field FVector:D3DXVECTOR3
Global Created:Int = 0
Global List:TList
Function Create()
If Not THolderBlock.List
THolderBlock.List = CreateList()
End If
For Local y1:Int = 0 Until 8
For Local x1:Int = 0 Until 8
If CubeArray[x1, y1] = 1
Local th:THolderBlock = New THolderBlock
th.FVector = _D3DXVECTOR3()
th.FVector.x = x1 * 2.0
th.FVector.y = y1 * 2.0
th.FVector.z = 0.0
th.FBody = iBodyCreate("res\\models\\holder1_5.00.ply")
th.FMesh = iBodyMeshCreate("res\\models\\holder1.x", th.FBody)
THolderBlock.List.AddLast(th)
End If
Next
Next
End Function
End Type
Type TRedBlock
Field x:Float = 0.0
Field y:Float = 0.0
Field Vec:D3DXVECTOR3
Field RMesh:MESH
Field RBody:BODY
Field Duo:BODYBODY
Field Duo2:BODYBODY
Global List:TList
Function Create()
If not TRedBlock.List
TRedBlock.List = CreateList()
End If
For Local y:Int = 0 Until 8
For Local x:Int = 0 Until 8
If CubeArray[x, y] = 2
Local r:TRedBlock = New TRedBlock
r.Vec = _D3DXVECTOR3()
r.Vec.x = x * 2.00
r.Vec.y = y * 2.00
r.Vec.z = 0.0
r.RBody = iBodySGCreate("res\\models\\redcube_.spg", 2.0)
r.RMesh = iBodyMeshCreate("res\\models\\redcube.x", r.RBody)
For Local th:THolderBlock = EachIn THolderBlock.List
r.duo = iBodyBodyCreate(r.RBody, th.FBody)
iBodyBodyEnable(r.Duo, True)
iBodyBodyFrictionModelSet(r.Duo, 0)
iBodyBodyRestitutionSet(r.Duo, 0.0)
iBodyBodyFrictionSet(r.Duo, 30.0)
Next
For Local r2:TRedBlock = EachIn TRedBlock.List
If r.RBody = r2.RBody Continue
r.Duo2 = iBodyBodyCreate(r.RBody, r2.RBody)
iBodyBodyEnable(r.Duo2, True)
iBodyBodyFrictionModelSet(r.Duo2, 0)
iBodyBodyRestitutionSet(r.Duo2, 0.0)
iBodyBodyFrictionSet(r.Duo2, 30.0)
Next
TRedBlock.List.AddLast(r)
End If
Next
Next
End Function
End Type
Global Cam:CAMERA
' begin 3Impact processing
myEngine.Start()
Local TTicks:Int = 0
Local Time:Int = MilliSecs()
Repeat
If MilliSecs() > Time + 20
tticks:+1
Time = MilliSecs()
End If
Until tticks >= 100
Type bmx_3IEngine Extends _3IEngine
' called to initialize game variables, load resources, etc
Method _Init()
iFrqSet(1.0 / 85.0)
Cam = iCameraCreate(0.0, 0.0, 1.0, 1.0)
iCameraLocationSet(Cam, _D3DXVECTOR3(6.0, 5.0, - 16.0))
' iCameraFovSet(Cam, 80.0)
iLightDirectionalSet(_D3DXVECTOR3(1.0, - 1.0, 1.0), _D3DXVECTOR4(1.0, 1.0, 1.0, 0.35))
THolderBlock.Create()
TRedBlock.Create()
For Local th:THolderBlock = EachIn THolderBlock.List
iBodyEnable(th.FBody)
iMeshShow(th.FMesh)
Next
For Local r:TRedBlock = EachIn TRedBlock.List
iMeshShow(r.RMesh)
iBodyEnable(r.RBody)
Next
For Local th:THolderBlock = EachIn THolderBlock.List
iMeshLocationSet(th.FMesh, _D3DXVECTOR3(th.FVector.x, th.fvector.y, th.fvector.z))
iBodyLocationSet(th.FBody, _D3DXVECTOR3(th.FVector.x, th.fvector.y, th.fvector.z), True)
Next
For Local r:TRedBlock = EachIn TRedBlock.List
iMeshLocationSet(r.RMesh, _D3DXVECTOR3(r.Vec.x, r.Vec.y, r.Vec.z))
iBodyLocationSet(r.RBody, _D3DXVECTOR3(r.Vec.x, r.Vec.y, r.Vec.z), True)
iBodyDampingSet(r.RBody, 8.0, 1.0, 0.0, 0.0)
Next
EndMethod
' the main game loop
Method _Run()
EndMethod
' called when the application exits in order to clean up
Method _Exit()
EndMethod
EndType
DefData 1, 1, 1, 1, 1, 1, 1, 1
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2