Показать сообщение отдельно
Старый 13.10.2020, 17:18   #8
Crystal
Терабайт исходников
 
Аватар для Crystal
 
Регистрация: 05.07.2007
Сообщений: 5,196
Написано 1,721 полезных сообщений
(для 5,374 пользователей)
Ответ: Очередные вопросы от меня по игровой логике и скриптингу

Сообщение от Randomize Посмотреть сообщение
Без RenderEntity было недостижимо. (в 3д)
Короче мож я чёто насвистел, посмотри сам.
10 лет блитц не видел, уже впадлу вспоминать чё там к чему.
Помню, что реализовал через свитч, при чём вторая часть его за рендер ворлдом.

Видео работы в архиве поста.
Вот прям из своего проекта код теме:


Graphics3D 1280,1024,32,1
SetBuffer BackBuffer()

Global ScreenSave#=0
Global ScreenZapusk#=0
Global ScreenNumber=1
Global ScreenShooting=0


Global Start=0
Global Sector#=2

font=LoadFont("courier",20)
font2=LoadFont("courier",100)
Dim Buttons(3)
Global kn1=LoadAnimImage("GUI-Button2.bmp",100,40,0,3)
Global kn2=LoadAnimImage("GUI-Button2.bmp",100,40,0,3)
Global kursor=LoadImage("GUI-Cursor.png")


Global Dom1=LoadMesh("Dom1.3DS")
HideEntity Dom1
Global Dom1_krisha=LoadMesh("Dom1_krisha.3DS")
HideEntity Dom1_krisha
Global Dom1_dver=LoadMesh("Dom1-dver.3DS")
HideEntity Dom1_dver

Global Di=LoadMesh("D.3DS")
HideEntity Di

Global God

Type Dom1
Field ent
Field ent_k
Field ent_d
Field pick#
Field Delet
End Type

Type Di
Field ent
Field pick#
End Type


Function ScreenShot(filename$)
If ScreenZapusk#=1 Then
If FileType(filename$+ScreenNumber+".BMP")=1 Then ScreenSave#=1
If FileType(filename$+ScreenNumber+".BMP")=0 Then ScreenSave#=0
If FileType(filename$+ScreenNumber+".BMP")=2 Then ScreenSave#=0
ScreenZapusk#=0
End If
If ScreenSave#=0 Then
SaveBuffer(FrontBuffer(),"ScreenShots\ScreenShot"+ScreenNumber+".bmp")
ScreenShooting=0
ScreenNumber=1
End If
If ScreenSave#=1 Then
ScreenNumber=ScreenNumber+1
ScreenZapusk#=1
End If
End Function



Function ConstructionsControl()
For c.Dom1=Each Dom1
If EntityDistance(c\ent_k,God)<7 Then
EntityAlpha c\ent_k,0.3
Else
EntityAlpha c\ent_k,1
End If
Next
End Function



Repeat 
Select Sector#
Case 1

      Cls()


God=CreatePivot()
PositionEntity God,0,5,-3
camera=CreateCamera(God) 
RotateEntity camera,40,0,0

light=CreateLight() 
TurnEntity light,30,20,0

plane=CreatePlane() 
EntityPickMode plane,2
planeTexture=LoadTexture("TEX38.BMP") 
ScaleTexture planeTexture,2,2
EntityTexture plane,planeTexture
  

  Repeat

If Start=0 Then
Start=1
LoadMap("TestMap.sel")
End If

ConstructionsControl()

If KeyHit(88) Then
ScreenZapusk#=1
ScreenShooting=1
End If
If ScreenShooting=1 Then
ScreenShot("ScreenShots\ScreenShot")
End If

If KeyDown(32)=True Then TurnEntity God,0,-1,0 
If KeyDown(30)=True Then TurnEntity God,0,1,0 
If KeyDown(31)=True Then MoveEntity God,0,0,-0.05 
If KeyDown(17)=True Then MoveEntity God,0,0,0.05 



If Buttons(1)=1 Then
Sector#=2 Buttons(1)=0
Start=0
WorldClear()

      FreeEntity God
      FreeEntity plane 
      FreeEntity light 
End If


      UpdateWorld()
      RenderWorld()

SetFont font

      RefreshButton(kn1,1150,12,"Menu",1)
      DrawImage kursor,MouseX(),MouseY()

      Flip

      
   Until Sector#=2


Case 2


   Cls()

    camera=CreateCamera()
    PositionEntity camera,0,3,0
        CameraFogMode camera,1
        CameraFogRange camera,.1,30

    plane= CreatePlane()
    
    pltex=LoadTexture("TEX38.BMP")
    ScaleTexture pltex,2,2
    EntityTexture plane,pltex
       FreeTexture pltex

    lit=CreateLight()
   
       

   Repeat 
   

      If KeyHit(1) And Sector#=2 Or Buttons(2)=1 And Sector#=2 Then exitprog=True Buttons(2)=0
      If  Buttons(0)=1 Then Sector#=1 Buttons(0)=0


      If exitprog=True End 


      UpdateWorld()
      RenderWorld()

SetFont font

           RefreshButton(kn2,GraphicsWidth()/7,GraphicsHeight()/2.5,"Game",0)
      RefreshButton(kn2,GraphicsWidth()/7,GraphicsHeight()/2.2,"Exit",2)

SetFont font2

           Color 230,230,230
      Text GraphicsWidth()/5,GraphicsHeight()/5,"SCORCHED EARTH"
      DrawImage kursor,MouseX(),MouseY()

      Flip 
   Until Sector#=1
      FreeEntity camera
      FreeEntity plane 
      FreeEntity lit 


End Select


Until  exitprog=True

Function RefreshButton(ImBtn,x,y,txt$,n)
mx=MouseX() : my=MouseY()
MHit=MouseDown(1)
If RectsOverlap(x+2,y+2,ImageWidth(ImBtn)-4,ImageHeight(ImBtn)-4,mx,my,1,1) Then
     f=1
     y2=0
     If MHit=True Then 
           f=2 
           y2=2 
           Buttons(n)=1 
     EndIf 
Else 
     f=0
     y2=0
EndIf 
DrawImage ImBtn,x,y,f 
Color 0,0,0 
Text x + 0.5 * (ImageWidth(ImBtn) + 4 - Len(txt$) * FontHeight() * 0.5), y + 0.5 * (ImageHeight(ImBtn) - 4 - FontHeight()) + y2, txt$
End Function 






Function LoadMap(Name$)

stroitelstvo#=0

file=ReadFile(Name$)

While Not Eof(file)

Load = ReadInt(file)
Select Load

	Case 1
		c.Dom1=New Dom1
		c\ent=CopyMesh(Dom1)
		c\ent_k=CopyMesh(Dom1_krisha)
		c\ent_d=CopyMesh(Dom1_dver)

		c\pick#=ReadFloat(File)
		a1#=ReadFloat(File)
		a2#=ReadFloat(File)
		a3#=ReadFloat(File)
		a4#=ReadFloat(File)
		a5#=ReadFloat(File)
		a6#=ReadFloat(File)	
		
		a7#=ReadFloat(File)
		a8#=ReadFloat(File)
		a9#=ReadFloat(File)
		a10#=ReadFloat(File)
		a11#=ReadFloat(File)
		a12#=ReadFloat(File)
		
		a13#=ReadFloat(File)
		a14#=ReadFloat(File)
		a15#=ReadFloat(File)
		a16#=ReadFloat(File)
		a17#=ReadFloat(File)
		a18#=ReadFloat(File)	
 
		ScaleEntity c\ent,0.01,0.01,0.01
		PositionEntity c\ent,a1#,a2#,a3#
		RotateEntity c\ent,a4#,a5#,a6#
		
		ScaleEntity c\ent_k,0.01,0.01,0.01
		PositionEntity c\ent_k,a7#,a8#,a9#
		RotateEntity c\ent_k,a10#,a11#,a12#

		ScaleEntity c\ent_d,0.01,0.01,0.01
		PositionEntity c\ent_d,a13#,a14#,a15#
		RotateEntity c\ent_d,a16#,a17#,a18#

        EntityPickMode c\ent,2

	Case 2

		co.Di=New Di
		co\ent=CopyMesh(Di) 

		X2#=ReadFloat(file)
		Y2#=ReadFloat(file)
		Z2#=ReadFloat(file)
		P2#=ReadFloat(file)
		YA2#=ReadFloat(file)
		R2#=ReadFloat(file)
		SX2#=ReadFloat(file)
		SY2#=ReadFloat(file)
		SZ2#=ReadFloat(file)
		co\pick#=ReadFloat(file)

		PositionEntity co\ent,X2#,Y2#,Z2#
		ScaleEntity co\ent,0.01,0.01,0.01
		RotateEntity co\ent,P2#,YA2#,R2#


End Select

Wend
CloseFile(file)

End Function


Function WorldClear()

Cls

For d.Dom1 = Each Dom1
FreeEntity d\ent
FreeEntity d\ent_k
FreeEntity d\ent_d
Delete d
Next

For do.Di = Each Di
FreeEntity do\ent
Delete do
Next
End Function


Добавил: вот смотрю я код, а там функция ВорлдКлир.
По ходу не исключал из рендера, а загружал и удалял объекты.
Вложения
Тип файла: rar menu-perehod.rar (3.58 Мб, 450 просмотров)
__________________
Проект "Deathbring World - Rangers" и его финансовая поддержка:
https://boosty.to/deathbringrangers

Я на - TWITCH
Канал на YouTube

Последний раз редактировалось Crystal, 14.10.2020 в 06:11.
(Offline)
 
Ответить с цитированием