Helicopter

Everything related to 3D programming
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Helicopter

Post by DK_PETER »

Here's a link to a helicopter sound..I'll leave it here untill New year.
They're easy to find.
Gone.....

Edit: Removed redundant declaration and fixed tail texture with font repositioned correctly.
Added init check...my way. :twisted:

Code: Select all

;Helicopter - template Base project
;----------------------------------
;F12 - Start Engine
;F11 - Turn off engine
;+ - increase rotorspeed
;- - Decrease rotorspeed
;z = bank left
;x = bank right
;Arrow up - Increase height
;Arrow left - backward
;Arrow right - Forward
;----------------------------------
;No turning implemented
;No tiling implemented
;----------------------------------
If InitEngine3D() = 0
  MessageRequester("Your system is fubar!", "Unable to load 3D engine")
  End
EndIf
If InitSprite() = 0
  MessageRequester("Can't open a screen? WTF??", "Remind me to never buy a system like yours")
  End
EndIf
If InitKeyboard() = 0
  MessageRequester("COME ON!!!!", "No keyboard? Really??")
  End
EndIf
If InitSound() = 0
  MessageRequester("Hah!", "Silent movie.")
  End
EndIf


UseOGGSoundDecoder()

Structure _object
  ma.i
  ms.i
  tx.i[6]
  id.i
  speed.f
EndStructure

Structure _chop
  body._object
  MainRotor._object[3]
  rotorGear._object
  tailRotor._object[2]
  TailGear._object
  tail._object[2]
  legs._object[6]
  mainrotorNode.i
  tailrotorNode.i
  bodyNode.i
  mainobject._object
EndStructure

Structure _spr
  Id.i
  Rpm.i
EndStructure

Declare.i CreateHeli()
Declare.i CreateScene()

Global ch._chop, sn.i, ground._object, rpm._spr, RotorSpeed.f = 0.0, Ignite.i = 0, Quit.i = #False
Global TailFont.i

OpenWindow(0, 0, 0, 1024, 768, "'Chopper'", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768)
Add3DArchive("\", #PB_3DArchive_FileSystem)
Add3DArchive(".", #PB_3DArchive_FileSystem)

TailFont = LoadFont(#PB_Any, "Arial", 36)

WorldShadows(#PB_Shadow_Modulative)
CreateCamera(0, 0, 0, 100, 100)
CameraRange(0, 0, 1400)
MoveCamera(0, 0, 0.1, 7)
CameraBackColor(0, $E28B29)
CreateCamera(1, 0, 0, 20, 20)
CameraBackColor(1, $E28B29)
CreateLight(0, $FFFFFFFF, 0, 100, 0)

ret = CreateHeli()
ret = CreateScene()

rpm\Rpm = -1

Repeat
  
  Repeat
    ev = WindowEvent()
    If ev = #PB_Event_CloseWindow : Quit = #True : EndIf
  Until ev = 0

  ExamineKeyboard()
  
  If KeyboardPushed(#PB_Key_Add) And RotorSpeed < 50
    RotorSpeed + 0.1
  ElseIf KeyboardPushed(#PB_Key_Subtract) And RotorSpeed > 20
    RotorSpeed - 0.1
  ElseIf KeyboardReleased(#PB_Key_F12) And Ignite = 0
    Ignite = 1
    If sn > 0
      PlaySound(sn, #PB_Sound_Loop)
    EndIf
  ElseIf KeyboardReleased(#PB_Key_F11) And Ignite = 1
    Ignite = 0
  EndIf
  
  If Ignite = 1 And RotorSpeed < 40
    RotorSpeed + 0.1
  ElseIf Ignite = 0 And RotorSpeed > 0
    RotorSpeed - 0.1
    If RotorSpeed <= 0 
      RotorSpeed = 0 
      If sn > 0
        StopSound(sn)
      EndIf
    EndIf  
  EndIf
  
  If RotorSpeed <> rpm\Rpm
    If rpm\Id > 0
      FreeSprite(rpm\Id)
    EndIf
    rpm\Rpm = RotorSpeed
    rpm\Id = CreateSprite(#PB_Any, 150, 40,#PB_Sprite_AlphaBlending)
    StartDrawing(SpriteOutput(rpm\Id))
    DrawingMode(#PB_2DDrawing_Outlined)
    Box(1, 1, 149, 59, $FFFF15)
    DrawingMode(#PB_2DDrawing_Transparent)
    DrawText(2, 3, "RPM: " + StrF(rpm\Rpm*100,2), $FFFF15)
    StopDrawing()
    TransparentSpriteColor(rpm\Id, 0)
  EndIf
  
  If RotorSpeed > 40
    If KeyboardPushed(#PB_Key_Up)
      ApplyEntityImpulse(ch\mainobject\id, 0, 0.009, 0, 0, 0, 0)
    EndIf
    If KeyboardPushed(#PB_Key_Left)
      ApplyEntityImpulse(ch\mainobject\id, -0.001, 0, 0, 0, 0, 0)
    EndIf
    If KeyboardPushed(#PB_Key_Right)
      ApplyEntityImpulse(ch\mainobject\id,  0.001, 0, 0, 0, 0, 0)
    EndIf
    If KeyboardPushed(#PB_Key_Z)
      ApplyEntityImpulse(ch\mainobject\id,  0, 0, 0.001, 0, 0, 0)
    EndIf
    If KeyboardPushed(#PB_Key_X)
      ApplyEntityImpulse(ch\mainobject\id,  0, 0, -0.001, 0, 0, 0)
    EndIf
  EndIf
  
  RotateNode(ch\mainrotorNode, 0, RotorSpeed, 0, #PB_Relative)
  RotateNode(ch\tailrotorNode, 0, 0, RotorSpeed, #PB_Relative)
  CameraFollow(1, EntityID(ch\mainobject\id), 5, 10, 10, 10, 10)
  CameraLookAt(0, EntityX(ch\mainobject\id), EntityY(ch\mainobject\id), EntityZ(ch\mainobject\id))

  RenderWorld()
  DisplayTransparentSprite(rpm\Id, 1, ScreenHeight()-SpriteHeight(rpm\Id))
  FlipBuffers()
  
Until KeyboardPushed(#PB_Key_Escape) Or quit = #True

Procedure.i CreateHeli()
  With ch\body
    \ms = CreateSphere(#PB_Any, 0.5, 20, 20)
    TransformMesh(\ms, 0, 0, 0, 2.5, 1.2, 1, 0, 0, 0)
    \tx[0] = CreateTexture(#PB_Any, 2048, 2048)
    StartDrawing(TextureOutput(\tx[0]))
    Box(0, 0, 2048, 2048, $DEDADA)
    Box(0, 256, 1024, 512, $DEDADA)
    DrawingMode(#PB_2DDrawing_Default)
    Box(1032, 786, 20, 10, $92918D)
    Box(1028, 256, 128, 512, $DEDADA)
    Box(1917, 256, 128, 512, $DEDADA)
    DrawingMode(#PB_2DDrawing_Outlined)
    Box(1917, 768, 128, 512, $92918D)
    Box(1918, 769, 126, 510, $92918D)
    Box(1027, 768, 128, 512, $92918D)
    Box(1028, 767, 128, 512, $92918D)
    DrawingMode(#PB_2DDrawing_Default)
    Box(2010, 786, 20, 10, $92918D)
    StopDrawing()
    \tx[1] = CreateTexture(#PB_Any, 2048, 2048)
    StartDrawing(TextureOutput(\tx[1]))
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0, 0, 2048, 2048, 0)
    Box(0, 256, 1024, 512, $F0DE910B)
    Box(1028, 256, 128, 512, $F0DE910B)
    Box(1917, 256, 128, 512, $F0DE910B)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any,TextureID(\tx[0]))
    AddMaterialLayer(\ma, TextureID(\tx[1]), #PB_Material_AlphaBlend)
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0.85, 0)
  EndWith
  With ch\legs[0]
    \ms = CreateCylinder(#PB_Any, 0.04, 2, 5, 1,0)
    \tx[0] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[0]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0.001, 0.38)
    RotateEntity(\id, 0, 0, 90)
  EndWith
  With ch\legs[1]
    \ms = CreateCylinder(#PB_Any, 0.04, 0.5, 5, 1,0)
    \tx[1] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[1]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx[1]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0.5, 0.2, 0.27)
    RotateEntity(\id, -30, 0, 0)
  EndWith
  With ch\legs[2]
    \ms = CreateCylinder(#PB_Any, 0.04, 0.5, 5, 1,0)
    \tx[2] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[2]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx[2]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), -0.5, 0.2, 0.27)
    RotateEntity(\id, -30, 0, 0)
  EndWith
  With ch\legs[3]
    \ms = CreateCylinder(#PB_Any, 0.04, 2, 5, 1,0)
    \tx[3] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[3]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx[3]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0.001, -0.38)
    RotateEntity(\id, 0, 0, 90)
  EndWith
  With ch\legs[4]
    \ms = CreateCylinder(#PB_Any, 0.04, 0.5, 5, 1,0)
    \tx[4] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[4]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
   \ma = CreateMaterial(#PB_Any, TextureID(\tx[4]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0.5, 0.2, -0.27)
    RotateEntity(\id, 30, 0, 0)
  EndWith
  With ch\legs[5]
    \ms = CreateCylinder(#PB_Any, 0.04, 0.5, 5, 1,0)
    \tx[5] = CreateTexture(#PB_Any, 64, 64)
    StartDrawing(TextureOutput(\tx[5]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(0, 0, 64, 64)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx[5]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    ScaleMaterial(\ma, 0.5, 0.5)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), -0.5, 0.2, -0.27)
    RotateEntity(\id, 30, 0, 0)
  EndWith
  With ch\tail[0]
    \ms = CreateCylinder(#PB_Any, 0.1, 1)
    TransformMesh(\ms, 0, 0, 0, 1.0, 1.5, 0.6, 0, 0, 0)
    \tx[0] = CreateTexture(#PB_Any, 1024, 1024) 
    StartDrawing(TextureOutput(\tx[0]))
    If TailFont > 0
      DrawingFont(FontID(TailFont))
    EndIf
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0, 0, 1024, 1024, $FFDEDADA)
    DrawingMode(#PB_2DDrawing_Transparent)
    DrawText(420, 148, "GalCorp FBE-16F9", $FFFF4C5E)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    RotateMaterial(\ma, 90, 0, 0)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), -1.9, 0.8, 0)
    RotateEntity(\id, 0, 0, 90)
  EndWith
  With ch\tail[1]
    \ms = CreateCylinder(#PB_Any, 0.1, 1)
    TransformMesh(\ms, 0, 0, 0, 0.8, 0.5, 0.6, 0, 0, 0)
    \tx[1] = CreateTexture(#PB_Any, 2048, 2048) 
    StartDrawing(TextureOutput(\tx[1]))
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0, 0, 2048, 2048, $FFDEDADA)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[1]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), -2.79, 0.95, 0)
    RotateEntity(\id, 0, 0, 45)
  EndWith
  With ch\rotorGear
    \ms = CreateCylinder(#PB_Any, 0.04, 0.1)
    \tx[0] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[0]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 1.5, 0)
  EndWith
  With ch\TailGear
    \ms = CreateCylinder(#PB_Any, 0.02, 0.05)
    \tx[0] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[0]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
    RotateEntity(\id, 90, 0, 0)
  EndWith
  With ch\MainRotor[0]
    \ms = CreateCylinder(#PB_Any, 0.2, 10)
    TransformMesh(\ms, 0, 0, 0, 0.1, 0.01, 10, 0, 0, 0)
    \tx[0] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[0]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
    RotateEntity(\id, 0, 0, 90)
  EndWith
  With ch\MainRotor[1]
    \ms = CreateCylinder(#PB_Any, 0.2, 10)
    TransformMesh(\ms, 0, 0, 0, 0.1, 0.01, 10, 0, 0, 0)
    \tx[1] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[1]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[1]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
    RotateEntity(\id, 90, 0, 90)
  EndWith
  With ch\tailRotor[0]
    \ms = CreateCylinder(#PB_Any, 0.1, 5)
    TransformMesh(\ms, 0, 0, 0, 0.07, 0.01, 3, 0, 0, 0)
    \tx[0] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[0]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[0]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
    RotateEntity(\id, 0, 90, 0)
  EndWith
  With ch\tailRotor[1]
    \ms = CreateCylinder(#PB_Any, 0.1, 5)
    TransformMesh(\ms, 0, 0, 0, 0.07, 0.01, 3, 0, 0, 0)
    \tx[1] = CreateTexture(#PB_Any, 128, 128)
    StartDrawing(TextureOutput(\tx[1]))
    DrawingMode(#PB_2DDrawing_Gradient)
    FrontColor($3B3832) : BackColor($86807D)
    LinearGradient(10, 10, 54, 54)
    Box(0, 0, 64, 64)
    StopDrawing()
    \ma  = CreateMaterial(#PB_Any, TextureID(\tx[1]))
    MaterialCullingMode(\ma, #PB_Material_NoCulling)
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
    RotateEntity(\id, 90, 90, 0)
  EndWith
  ;Attachments
  ch\bodyNode = CreateNode(#PB_Any, 0, 0, 0)
  ch\mainrotorNode = CreateNode(#PB_Any,  0, 1.6, 0)
  ch\tailrotorNode = CreateNode(#PB_Any, -2.951, 1.1, -0.082)
  With ch
    AttachNodeObject(\bodyNode, EntityID(\body\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[0]\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[1]\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[2]\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[3]\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[4]\id))
    AttachNodeObject(\bodyNode, EntityID(\legs[5]\id))
    AttachNodeObject(\bodyNode, EntityID(\rotorGear\id))
    AttachNodeObject(\bodyNode, EntityID(\tail[0]\id))
    AttachNodeObject(\bodyNode, EntityID(\tail[1]\id))
    AttachNodeObject(\mainrotorNode, EntityID(\MainRotor[0]\id))
    AttachNodeObject(\mainrotorNode, EntityID(\MainRotor[1]\id))
    AttachNodeObject(\tailrotorNode, EntityID(\TailRotor[0]\id))
    AttachNodeObject(\tailrotorNode, EntityID(\TailRotor[1]\id))
    AttachNodeObject(\tailrotorNode, EntityID(\TailGear\id))
    \mainobject\ms = CreateCube(#PB_Any, 0.01)
    TransformMesh(\mainobject\id, 0, 0, 0, 3, 0.2, 3, 0, 0, 0)
    UpdateMeshBoundingBox(\mainobject\ms)
    \mainobject\id = CreateEntity(#PB_Any, MeshID(\mainobject\ms), #PB_Material_None, 0, 0, 0)
    HideEntity(\mainobject\id, #True)
    AttachEntityObject(\mainobject\id, "", NodeID(\bodyNode))
    AttachEntityObject(\mainobject\id, "", NodeID(\mainrotorNode))
    AttachEntityObject(\mainobject\id, "", NodeID(\tailrotorNode))
    CreateEntityBody(\mainobject\id, #PB_Entity_BoxBody, 0.019)
  EndWith  
    sn = LoadSound(#PB_Any, "chop_01.wav")
  ProcedureReturn #True
EndProcedure

Procedure.i CreateScene()
  Protected col.i, x.i, y.i, z.i
  With ground
    \ms = CreateCube(#PB_Any, 1)
    TransformMesh(\ms, 0, 0, 0, 400, 0.5, 400, 0, 0, 0)
    UpdateMeshBoundingBox(\ms)
    \tx = CreateTexture(#PB_Any, 2048, 2048)
    StartDrawing(TextureOutput(\tx))
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0, 0, 2048, 2048, $FF9FA0A3)
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    For x = 1 To 2047 Step 256
      For y = 1 To 2047 Step 256
        Box(x, y+64, 256, 32, $FF6F7170)
        Box(x+64, y, 32, 256, $FFEFEEEC)
      Next y
    Next x  
    StopDrawing()
    \ma = CreateMaterial(#PB_Any, TextureID(\tx))
    MaterialFilteringMode(\ma, #PB_Material_Anisotropic, 8)
    ScaleMaterial(\ma, 0.1, 0.1)
    \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, -0.6, 0)
    CreateEntityBody(\id, #PB_Entity_BoxBody, 0)
  EndWith
  ProcedureReturn #True
EndProcedure
Last edited by DK_PETER on Fri Jan 01, 2016 10:17 am, edited 2 times in total.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Helicopter

Post by Keya »

looks fun, i'd love to try but don't have OpenGL or DirectX or whatever it is installed on this current system. Which highlights a particular flaw in a lot of graphics demos posted here ...

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()
InitSound()
... so often people seem to skip checking the return codes of those Init functions and (wrongly) assume success! In my case they all succeed except for InitEngine3D which returns 0. The program should detect and stop there, rather than continuing on and crashing as it currently does. :D sorry to be such a party pooper as i know the vast majority of people won't have this problem lol
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Helicopter

Post by DK_PETER »

@Keya
When it comes to quality coding for online posting in this forum - I'm waay too lazy to do
simple condition checking and use EnableExplicit. Others might be too lazy to add the
checking themselves when they copy/paste someones code.

When I'm testing a specific idea, I create a temporary mess to see my idea in action
and if it seems to be a little fun, then sometimes I might post it as is.
It is not meant to be flawless in any way - just 5 to 30 seconds of fun.

It works fine here which was my main objective. :-)

Concerning being a 'party pooper':....You're absolutely not one - (your system apparently is).
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Helicopter

Post by AndyLy »

Interesting, but I'm sure you can do better.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Helicopter

Post by DK_PETER »

AndyLy wrote:Interesting, but I'm sure you can do better.
So very true. A lot better. :D
I know that you can too..Why don't you add something? :lol:
The more code in the 3D section the better and I'm sure
that the silent majority appreciate the addition.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Helicopter

Post by AndyLy »

Sorry, I have no time even to develop my program, so ...
I'm thinking of doing the race (as part of game), like in Star Wars: Knights of the Old Republic.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Helicopter

Post by DK_PETER »

@AndyLy
That would be quite interesting. :wink:
Good luck with your project.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Post Reply