Вторник, 26 Ноября 2024, 02:45

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 1 из 1
  • 1
Ошбка в коде на Blitz3D
MatikДата: Воскресенье, 13 Ноября 2011, 18:35 | Сообщение # 1
частый гость
Сейчас нет на сайте
Помогите плиз кто шарит и может... Хочу создать редактор карт для своей игры а вот выдаёт ошибочку(((
Graphics3D 800,600,32,2
SetBuffer BackBuffer()

sav=LoadImage("interface\Save.bmp")
sav2=LoadImage("interface\Save2.bmp")
loa=LoadImage("interface\Load.bmp")
loa2=LoadImage("interface\Load2.bmp")
ScaleImage sav,0.5,0.5
ScaleImage sav2,0.5,0.5
ScaleImage loa,0.5,0.5
ScaleImage loa2,0.5,0.5

Include "includes\DevilShadowSystem.bb"
Include "includes\ShadowVolumes.bb"
Include "includes\UserInterface.bb"

Type ModelsTer
Field x
Field y
Field z
Field meshTER
Field moving
End Type

Type ModelsTree
Field x
Field y
Field z
Field meshTREE
Field moving
End Type

Type ModelsAk
Field x
Field y
Field z
Field meshAK
Field moving
End Type

tex=LoadTexture("asfalt.jpg")

cam=CreateCamera()
PositionEntity cam,0,5,0
ModeCam=1 ;1-not mouse, 2-mouse

il=CreateLight(2)
PositionEntity il,0,100,0

plan=CreatePlane()
PositionEntity plan,0,-1,0
EntityTexture plan,tex

While Not KeyHit(1)
; Create Models
If KeyHit(2) Then createmodelsTER(0,1,10)
If KeyHit(3) Then createmodelsTREE(0,1,10)
If KeyHit(4) Then createmodelsAK(0,1,10)
If KeyHit(64) Then SaveLevel("SavTer","SavTree","SavAk")
If KeyHit(65) Then LoadLevel("SavTer","SavTree","SavAk"):Cls

;Move models
;Move Terr
For m.modelsTer=Each modelsTer
If m\moving=True Then
If MouseDown(1) Then
MoveEntity m\meshTER,MouseXSpeed()*0.01,0,-MouseYSpeed()*0.01
MoveMouse 400,300
EndIf

If MouseDown(2) Then
MoveEntity m\meshTER,MouseXSpeed()*0.01,-MouseYSpeed()*0.01,0
MoveMouse 400,300
EndIf
EndIf
Next

If MouseHit(3)=True
ect=CameraPick(cam,MouseX(),MouseY())
If ect
For m.modelsTer=Each modelsTer
If Str(m\meshTER)=Str(ect) m\moving=True
If Str(m\meshTER)<>Str(ect) m\moving=False
Next
EndIf
EndIf

;Move Tree
For t.modelsTree=Each modelsTree
If t\moving=True Then
If MouseDown(1) Then
MoveEntity t\meshTREE,MouseXSpeed()*0.01,0,-MouseYSpeed()*0.01
MoveMouse 400,300
EndIf

If MouseDown(2) Then
MoveEntity t\meshTREE,MouseXSpeed()*0.01,-MouseYSpeed()*0.01,0
MoveMouse 400,300
EndIf
EndIf
Next

If MouseHit(3)=True
ect=CameraPick(cam,MouseX(),MouseY())
If ect
For t.modelsTree=Each modelsTree
If Str(t\meshTREE)=Str(ect) t\moving=True
If Str(t\meshTREE)<>Str(ect) t\moving=False
Next
EndIf
EndIf

;Move Ak
For a.modelsAk=Each modelsAk
If a\moving=True Then
If MouseDown(1) Then
MoveEntity a\meshAK,MouseXSpeed()*0.01,0,-MouseYSpeed()*0.01
MoveMouse 400,300
EndIf

If MouseDown(2) Then
MoveEntity a\meshAK,MouseXSpeed()*0.01,-MouseYSpeed()*0.01,0
MoveMouse 400,300
EndIf
EndIf
Next

If MouseHit(3)=True
ect=CameraPick(cam,MouseX(),MouseY())
If ect
For a.modelsAk=Each modelsAk
If Str(a\meshAK)=Str(ect) a\moving=True
If Str(a\meshAK)<>Str(ect) a\moving=False
Next
EndIf
EndIf

;Move camera
If KeyDown(17) Then MoveEntity cam,0,0,0.3
If KeyDown(31) Then MoveEntity cam,0,0,-0.3
If KeyDown(30) Then MoveEntity cam,-0.3,0,0
If KeyDown(32) Then MoveEntity cam,0.3,0,0

If KeyDown(17) And KeyDown(42) Then MoveEntity cam,0,0,1
If KeyDown(31) And KeyDown(42) Then MoveEntity cam,0,0,-1
If KeyDown(30) And KeyDown(42) Then MoveEntity cam,-1,0,0
If KeyDown(32) And KeyDown(42) Then MoveEntity cam,1,0,0

;ModeCam
If KeyHit(29) Then ModeCam=2
If KeyHit(56) Then ModeCam=1

If ModeCam=2 Then
TurnEntity cam,0,MouseXSpeed()*-0.1,0,1
TurnEntity cam,MouseYSpeed()*+0.1,0,0
MoveMouse 400,300
EndIf

RenderWorld

;Draws
DrawImage sav,0,0
DrawImage loa,125,0

If MouseX()>4 And MouseX()<110 And MouseY()>8 And MouseY()<30 Then DrawImage sav2,0,0
If MouseX()>129 And MouseX()<234 And MouseY()>8 And MouseY()<30 Then DrawImage loa2,125,0

If MouseX()>4 And MouseX()<110 And MouseY()>8 And MouseY()<30 And MouseDown(3) Then SaveLevel("SavTer","SavTree","SavAk")
If MouseX()>129 And MouseX()<234 And MouseY()>8 And MouseY()<30 And MouseDown(3) Then LoadLevel("SavTer","SavTree","SavAk"):Cls

Text 10,40,"X:"+Int(MouseX())
Text 10,50,"Y:"+Int(MouseY())

Flip
Wend
End

Function SaveLevel(nameter$,nametree$,nameak$)
File=WriteFile("maps\"+nameter$+".mex")
For m.modelsTer=Each modelsTer
WriteInt(File,m\x)
WriteInt(file,m\y)
WriteInt(File,m\z)
Next
CloseFile(File)

File2=WriteFile("maps\"+nametree$+".mex")
For t.modelsTree=Each modelsTree
WriteInt(File,t\x)
WriteInt(file,t\y)
WriteInt(File,t\z)
Next
CloseFile(File2)

File3=WriteFile("maps\"+nameak$+".mex")
For a.modelsAk=Each modelsAk ; Вылетает ошибка: "Variable type mismatch". Курсор моргает в начале этой строки.
WriteInt(File,a\x)
WriteInt(file,a\y)
WriteInt(File,a\z)
Next
CloseFile(File3)
End Function

Function LoadLevel(nameter$,nametree$,nameak$)
File=ReadFile("maps\"+nameter$+".mex")
For m.modelsTer=Each modelsTer
FreeEntity m\meshTER
Delete m
Next
While Not Eof(File)
a=ReadInt(File)
b=ReadInt(File)
c=ReadInt(File)
createmodelsTER(a,b,c)
Wend
CloseFile(File)

File2=ReadFile("maps\"+nametree$+".mex")
For t.modelsTree=Each modelsTree
FreeEntity t\meshTREE
Delete t
Next
While Not Eof(File2)
a1=ReadInt(File2)
b1=ReadInt(File2)
c1=ReadInt(File2)
createmodelsTREE(a1,b1,c1)
Wend
CloseFile(File2)

File3=ReadFile("maps\"+nameak$+".mex")
For a.modelsAk=Each modelsAk
FreeEntity a\meshAK
Delete a
Next
While Not Eof(File3)
a2=ReadInt(File3)
b2=ReadInt(File3)
c2=ReadInt(File3)
createmodelsAK(a2,b2,c2)
Wend
CloseFile(File3)
End Function

Function createmodelsTER.modelsTer(x,y,z)
m.modelsTer=New modelsTer
m\x=x
m\y=y
m\z=z
m\mesh=LoadMesh("models\ter.b3d")
m\moving=True
tex2=LoadTexture("models\neutral-stone.jpg")
PositionEntity m\meshTER,x,y,z
EntityTexture m\meshTER,tex2
EntityPickMode m\meshTER,2
Return m
End Function

Function createmodelsTREE.modelsTree(x,y,z)
t.modelsTree=New modelsTree
t\x=x
t\y=y
t\z=z
t\meshTREE=LoadMesh("models\treesB3D1.b3d")
t\moving=True
PositionEntity t\meshTREE,x,y,z
EntityPickMode t\meshTREE,2
Return t
End Function

Function createmodelsAK.modelsAk(x,y,z)
a.modelsAk=New modelsAk
a\x=x
a\y=y
a\z=z
a\meshAK=LoadMesh("models\ak47.3ds")
a\moving=True
PositionEntity a\meshAK,x,y,z
EntityPickMode a\meshAK,2
Return a
End Function


Сообщение отредактировал g336666 - Воскресенье, 13 Ноября 2011, 18:47
  • Страница 1 из 1
  • 1
Поиск:

Все права сохранены. GcUp.ru © 2008-2024 Рейтинг