كود:
Dim Par As New Arab_Lib_Particle
Dim Media As New Arab_Lib_Movie
Dim Chat As New Arab_Lib_Chat
Dim Misc As New Arab_Lib_Misc
Dim Md2 As New Arab_Lib_MD2
Dim MDL As New Arab_Lib_MDL
Dim Dialog As New Arab_Lib_Choose_Dialog
Dim key As New Arab_Lib_Control
Dim Collosion As New Arab_Lib_Collosion
Dim Effects As New Arab_Lib_Effects
Dim Mesh As New Arab_Lib_Mesh
Public Sub Init1()
If I_Level(0) = True Then
I_Level(0) = False
Camera.Camera_SetPosition Helper.R3DPoint3D(-132, 28, -41)
Camera.Camera_SetRotation Helper.R3DVector3D(0, 20, 0)
Call Load_Sound
Call Load_Texture_Mat
Call Load_Mesh
End If
End Sub
Private Sub Load_Texture_Mat()
Texture.Texture_Load "md2t", App.path & "/models/textures/2.bmp"
Texture.Texture_Load "3ds", App.path & "/images/meshes/textures/1.bmp"
Texture.Texture_Load "3ds2", App.path & "/images/meshes/textures/2.bmp"
Texture.Texture_Load "PSTexture0", App.path & "/images/effects/particle14.bmp"
Material.Material_Create "mat1"
Material.Material_SetAlpha 0
End Sub
Private Sub Load_Sound()
Media.Play_Audio App.path & "/medias/sounds/1.mp3"
End Sub
Private Sub Load_Mesh()
Meshbuilder.Mesh_Create "3ds1"
Meshbuilder.Mesh_Add3DS App.path & "/meshes/1.3ds"
Meshbuilder.Mesh_SetScale 0.1, 0.1, 0.1
Meshbuilder.Mesh_SetTexture 0, "3ds"
Meshbuilder.Mesh_Create "3ds2"
Meshbuilder.Mesh_Add3DS App.path & "/meshes/2.3ds"
Meshbuilder.Mesh_SetTexture 0, "3ds2"
Meshbuilder.Mesh_SetPosition -250, -12, 100
Call Effects.Effect_Craete_AnimTexture("water_texture", App.path & "/images/serieses/water.bmp", 64, 64, 32)
Misc.Mesh_Create_Rect "water", 10, 0, 100, 200, 200, -100.4, 20, 150
MD2System.Model_Load App.path & "/models/md2s/2.md2", "md21"
MD2System.Model_SetPosition Helper.R3DPoint3D(-170, 14, 12)
MD2System.Model_SetScale Helper.R3DVector3D(0.4, 0.4, 0.4)
MD2System.Model_SetTexture 0, "md2t"
Meshbuilder2.Mesh_Create "md2_wall1"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(100, 30, 100)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-200, 15, 125)
Meshbuilder2.Mesh_SetMaterial "mat1"
Meshbuilder2.Mesh_Create "md2_wall2"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(10, 30, 700)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-110, 15, 0)
Meshbuilder2.Mesh_SetMaterial "mat1"
Meshbuilder2.Mesh_Create "md2_wall3"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(10, 30, 700)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-245, 15, 0)
Meshbuilder2.Mesh_SetMaterial "mat1"
Meshbuilder2.Mesh_Create "md2_wall4"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(200, 30, 10)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-140, 15, 226)
Meshbuilder2.Mesh_SetMaterial "mat1"
Meshbuilder2.Mesh_Create "md2_wall5"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(200, 30, 28)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-270, 15, -25)
Meshbuilder2.Mesh_SetMaterial "mat1"
Meshbuilder2.Mesh_Create "md2_wall6"
Meshbuilder2.Mesh_AddBox Helper.R3DVector3D(200, 30, 10)
Meshbuilder2.Mesh_SetPosition Helper.R3DPoint3D(-140, 15, -200)
Meshbuilder2.Mesh_SetMaterial "mat1"
Par.Fountain -195.4, 7.6, 150, 1
Call Chat.Chat_Init(App.path & "/images/Dialogs/chat.txt", App.path & "/images/dialogs/chat2.jpg")
Call Dialog.Choose_Init(App.path & "\images\dialogs\chat4.jpg", App.path & "/images/miscs/arrow.bmp")
End Sub
Private Sub Draw_Text()
Interface2d.Primitive_DrawText 0, 10, "FPS : " & Fps.GetFrameTime
Interface2d.Primitive_DrawText 0, 30, " X = " & Camera.Camera_GetPosition.X & " Y = " & Camera.Camera_GetPosition.Y & " Z = " & Camera.Camera_GetPosition.Z
Interface2d.Primitive_DrawText 0, 50, " Rotation On Y-axis = " & Camera.Camera_GetRotation.Y
Interface2d.Primitive_DrawText 0, 70, " Z = " & MD2System.Model_GetPosition.Z
End Sub
Public Sub Play1()
'Call Effects.Effect_Animate_Texture("water_texture", 2)
Md2.MD2_Room 39, 45, 0, 2
If MD2System.Model_GetPosition.Z > 0 Then
Camera.Camera_SetPosition Helper.R3DPoint3D(-132, 28, -41)
Camera.Camera_SetRotation Helper.R3DVector3D(0, 20, 0)
Else
Camera.Camera_SetPosition Helper.R3DPoint3D(-229.78, 22.75, -187)
Camera.Camera_SetRotation Helper.R3DVector3D(0, 324.75, 0)
End If
Call Draw_Text
Call Dialog.Dialog_ChooseFrom("What do you Want to do now ?", "Go to Sleep", "Kill Some Bugs", "Talk to DR.X", "None Of your bisenes", 200, 200)
If Dialog.Chooses = 3 Then Call Chat.Chat(1, 4)
Call Collosion.Control_collosion_MD2_X_Meshbuilder2(2)
Call key.Control_Move_Camera_2
If Pause_Move = False Then Call key.Control_Move_MD2(1)
End Sub
وهذا توضيح للكود :