Particle Fire

Advanced game related topics
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Particle Fire

Post by J. Baker »

Most of you have probably already done this with the particles but if not, here you go.

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Particle
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;

#CameraSpeed = 10

IncludeFile "Screen3DRequester.pb"

DefType.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D()

  Add3DArchive("Data\", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    LoadTexture(0, "Flare.png")
    
    CreateMaterial(0, TextureID(0))
      DisableMaterialLighting(0, 1)
      MaterialBlendingMode   (0, 2)
        
    CreateParticleEmitter(0, 5, 1, 1, 0)
      ParticleMaterial    (0, MaterialID(0))
      ParticleTimeToLive  (0, 0.75, 0.75)
      ParticleEmissionRate(0, 20)
      ParticleSize        (0, 30, 45)
      ParticleColorRange  (0, RGB(255,255,0), RGB(255,0,0))

    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,400)
          
    Repeat
      Screen3DEvents()
      
      ClearScreen(0, 0, 0)
            
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
                  
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf

      EndIf
      
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
      
      RotateCamera(0, MouseX, MouseY, RollZ)
      MoveCamera  (0, KeyX, 0, KeyY)
    
      RenderWorld()
      Screen3DStats()

      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

cool in a werid way,
muiltcolored flames...
~Dreglor
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Ut oh. Now I'm playing with 3D stuff all day :-)

Cool fire!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Does not work on Windows 2000 w/ PB 3.80. Anybody else tested this yet?
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

Nice One, Mr. Baker :!:
Runs perfectly on WinXP

@Shannara: What kind of error do you get :?:
regards,
benny!
-
pe0ple ar3 str4nge!!!
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post by dontmailme »

Shannara wrote:Does not work on Windows 2000 w/ PB 3.80. Anybody else tested this yet?
Ok on my 2000+PB 3.80 :)
Paid up PB User !
CS2001
User
User
Posts: 14
Joined: Mon Jun 09, 2003 6:17 pm
Location: Germany
Contact:

Post by CS2001 »

Maybe i'am wrong, but isn't this the Particle Example in the Example directory?
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

I use jaPBe for my editor. The debugger highlights the line for FullScreen( ... no errors listed, but that is where it stops no matter if you choose windowed or full screen.. btw, I have duplicated the same error on Win2003 Standard Server, and on my work Win2k computer.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

CS2001 wrote:Maybe i'am wrong, but isn't this the Particle Example in the Example directory?


Yes it is. I just tweaked a few settings to make it look like fire. I'm not claiming that I wrote the whole code. Sorry if I mislead you. 8)
Post Reply