Показать сообщение отдельно
Старый 25.08.2013, 00:12   #4
Devilox
ПроЭктировщик
 
Аватар для Devilox
 
Регистрация: 14.01.2012
Адрес: Зеленоград
Сообщений: 192
Написано 5 полезных сообщений
(для 9 пользователей)
Ответ: Управление отдельными объектами из типа.

Вроде работает, но у меня ощущение, что я тут зря намудрил. Подскажете что-нибудь?

Graphics3D 0,0,32,1
SetBuffer BackBuffer()

Type T_cubes
	Field x
	Field y
	Field z
	Field col$
	Field ent
	Field hndl
End Type


cam = CreateCamera()

CreateCubes()

While Not KeyDown(1)

UpdateWorld()
RenderWorld()

Flip

Wend

End

;---------------------------------------------------;

Function CreateCubes()
	
	For i = 1 To 10
		cube.T_cubes = New T_cubes
		cube\ent = CreateCube()
		cube\x = i * 3 - 15
		cube\y = 0
		cube\z = 20
		cube\hndl = Handle(cube.T_cubes)
		
		If i > 1
			pointer.T_cubes = New T_cubes		
			pointer.T_cubes = Object.T_cubes(i - 1)
		
			If pointer\col = "green"
				cube\col = "blue"
			ElseIf pointer\col = "blue"
				cube\col = "red"
			ElseIf pointer\col = "red"
				cube\col = "green"
			EndIf
		Else			
			n = Rand(1,3)
		
			If n = 1
				cube\col = "red"
				EntityColor cube\ent,255,0,0
			ElseIf n = 2
				cube\col = "green"
				EntityColor cube\ent,0,255,0
			ElseIf n = 3
				cube\col = "blue"
				EntityColor cube\ent,0,0,255
			EndIf
		EndIf
		
		If cube\col = "red"
			EntityColor cube\ent,255,0,0
		ElseIf cube\col = "green"
			EntityColor cube\ent,0,255,0
		ElseIf cube\col = "blue"
			EntityColor cube\ent,0,0,255
		EndIf
		
		PositionEntity cube\ent,cube\x,cube\y,cube\z
	Next
End Function
__________________
(Offline)
 
Ответить с цитированием