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

Работает!!!!

Function CreateCubes()
	For y = 1 To 10
		For x = 1 To 10
			cube.T_cubes = New T_cubes
			cube\ent = CreateCube()
			cube\x = x * 3 - 15
			cube\y = y * 3 - 15
			cube\z = 20
			map(x,y) = Handle(cube.T_cubes)
			
			If x = 1 And y = 1
				n = Rand(1,2)
				
				Select n
					Case 1
						cube\col = "red" : EntityColor cube\ent,255,0,0
					Case 2
						cube\col = "green" : EntityColor cube\ent,0,255,0
				End Select
			Else
				If x > 1
					pointer.T_cubes = Object.T_cubes(map(x - 1,y))
				
					If pointer\col = "red"
						cube\col = "green"
						EntityColor cube\ent,0,255,0
					ElseIf pointer\col = "green"
						cube\col = "red"
						EntityColor cube\ent,255,0,0
					EndIf
				Else
					pointer.T_cubes = Object.T_cubes(map(1,y - 1))
					
					If pointer\col = "red"
						cube\col = "green"
						EntityColor cube\ent,0,255,0
					ElseIf pointer\col = "green"
						cube\col = "red"
						EntityColor cube\ent,255,0,0
					EndIf
				EndIf
			EndIf				
				
			PositionEntity cube\ent,x * 3 - 15,y * 3 - 15,20
		Next
	Next
End Function
if x = 1 and y = 1 надо оставить, т.к. это условие абсолютного начала генерации
__________________
(Offline)
 
Ответить с цитированием