Показать сообщение отдельно
Старый 10.11.2010, 18:28   #1112
Ganociy
Разработчик
 
Аватар для Ganociy
 
Регистрация: 02.06.2009
Адрес: Город Герой Ленинград
Сообщений: 392
Написано 33 полезных сообщений
(для 74 пользователей)
Ответ: Вопрос-Ответ (для новичков)

Function SaveMap(dir$)

file=WriteFile (dir$)

For b.Block= Each Block
WriteFloat file, EntityX (b\cube)
WriteFloat file, EntityY (b\cube)
WriteFloat file, EntityZ (b\cube)
Next

End Function

Function LoadMap(dir$)
file=ReadFile(dir$)
While Not Eof(file)

For b.Block=Each Block
x#=ReadFloat(File)
y#=ReadFloat(File)
z#=ReadFloat(File)
CreateBlock(x#,y#,z#,8,1.5,4)
Next

Wend
End Function


Type Block
Field cube
Field Texture
End Type

Function CreateBlock(x#,y#,z#,mw#,mh#,md#)
a.Block=New Block
a\cube=CreateCube ()
a\texture=LoadTexture ("Data\Textures\2.jpg")
EntityTexture a\cube, a\texture
ScaleEntity a\cube,mw#,mh#,md#
PositionEntity a\cube,x#,y#,z#-4.1
End Function

Type Sphere
Field model
Field Texture
End Type

Function CreateSphere(x#,y#,z#,mw#,mh#,md#)
a.Sphere=New Sphere
a\cube=CreateSphere ()
a\texture=LoadTexture ("Data\Textures\3.jpg")
EntityTexture a\model, a\texture
ScaleEntity a\model,mw#,mh#,md#
PositionEntity a\model,x#,y#,z#-4.1
End Function
__________________
Самый первый и самый великий программист - это Бог.
(Offline)
 
Ответить с цитированием