HI ALL!
Итак к проблеме:

Const CFieldWidth=15
Const CFieldHeight=15
Dim masPrep(CFieldWidth,CFieldHeight)
Dim masBonuses(CFieldWidth,CFieldHeight)
Type cubes
Field obj
Field nomerX, nomerZ
End Type
Graphics3D 800,600
Global CamX#=75
Global CamY#=90
Global CamZ#=-75
Global CamRX#=90
Global CamRY#=0
Global CamRZ#=0
camera=CreateCamera()
PositionEntity camera,CamX#,CamY#,CamZ#
RotateEntity camera, CamRX#,CamRY#,CamRZ#
fncreatelevel()
Repeat
If MouseHit(1)
For a.cubes=Each cubes
EntityColor a\obj,255,0,0
Next
EndIf
UpdateWorld
RenderWorld
Flip
Until KeyHit(1)
End
Function fnCreateLevel()
cube.cubes = New cubes
scub=CreateCube()
ScaleEntity scub,5,5,5
HideEntity scub
For x=0 To CFieldWidth-1
For z=0 To CFieldHeight-1
If ((x Mod 2)=1) And ((z Mod 2)=1) Then
cube.cubes = New cubes
cube\obj = CopyEntity(scub)
masPrep(x, z)=2
PositionEntity cube\obj, x * 10 + 5, 5, -z * 10 - 5
End If
Next
Next
Local kolvo = Rand(90,115)
For i = 1 To kolvo
cube.cubes = New cubes
cube\obj = CopyEntity(scub)
Local x_rnd = Rand (1,CFieldWidth-1)
Local z_rnd = Rand (1,CFieldHeight-1)
While Not (masPrep(x_rnd, z_rnd) = 0)
x_rnd = Rand (0,CFieldWidth-1)
z_rnd = Rand (0,CFieldHeight-1)
Wend
masPrep(x_rnd, z_rnd)=1
Local posX# = x_rnd * 10 + 5
Local posZ# = -z_rnd * 10 - 5
PositionEntity cube\obj,posX,5,posZ
EntityColor cube\obj,255,255,0
Next
End Function
по нажатию ЛКМ укбики должны покраситься в красный цвет.
но этого не происходит, и тем более entity does not exist.
Спасибо за внимание...