Engine

Blitz3D Forums/Blitz3D Programming/Engine

I use a very simple (but dead easy) Jet particle system for my spaceships. It is probably too basic for what you need, but may be okay as a starter.

In principle, it places a smoky sprite just behind the spacecraft with an initial alpha relative to the speed of the spaceship. Then, each loop, these sprites (maintained in a Type), are faded out (with EntityAlpha) then deleted when the Alpha gets to 0 (In fact, it may be more efficient to recycle the faded ones!)

Here's some sample code:


	NewShipJet.ship_jet=New ship_jet
	NewShipJet\sprite=CopyEntity (jet)


	PositionEntity newShipJet\sprite,EntityX(ship),EntityY(ship),EntityZ(ship)
	PointEntity newShipJet\sprite,cockpitcam
	MoveEntity newShipJet\sprite,0,0,4
	NewShipJet\alpha#=(speed#/topspeed#)
	ShowEntity NewShipJet\Sprite




For updateshipjet.ship_jet = Each ship_jet
    updateshipjet\alpha#=updateshipjet\alpha#-0.01
        If updateshipjet\alpha#<0 Then updateshipjet\alpha#=0
        EntityAlpha updateshipjet\sprite,updateshipjet\alpha#
            If updateshipjet\alpha#=0
                FreeEntity updateshipjet\sprite
                Delete updateshipjet
            EndIf
Next