Показать сообщение отдельно
Старый 10.11.2010, 18:41   #1114
pepel
Мастер
 
Аватар для pepel
 
Регистрация: 23.09.2009
Адрес: ленобласть
Сообщений: 1,189
Написано 447 полезных сообщений
(для 2,526 пользователей)
Ответ: Вопрос-Ответ (для новичков)

ну поидее так:
(поправил)
Function SaveMap(dir$)

file=WriteFile (dir$)

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

file=WriteFile (dir$)

For s.Sphere= Each Sphere
WriteFloat file, EntityX (s\model)
WriteFloat file, EntityY (s\model)
WriteFloat file, EntityZ (s\model)
Next
CloseFile(file)
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 

For s.Sphere=Each Sphere
x#=ReadFloat(File)
y#=ReadFloat(File)
z#=ReadFloat(File)
Create_Sphere(x#,y#,z#,8,1.5,4)
Next 

Wend
CloseFile(file)
End Function


Type Block
Field model
Field Texture
End Type 

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

Type Sphere
Field model
Field Texture
End Type 

Function Create_Sphere(x#,y#,z#,mw#,mh#,md#)
a.Sphere=New Sphere
a\model=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)
 
Ответить с цитированием