hey, i'm using 3d spheres textured with a flame like texture for my explosions in my 2d shootem up. problem is, i can get them to look realistic. they look ok but not what i'm looking for
here's my rough code
Graphics3D 800,600,32
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,0,-500
light=CreateLight()
explode=CreateSphere(16)
EntityAlpha explode,0.1
PositionEntity explode,-60,0,0
Dim texture(1)
texture(0)=LoadTexture("fire.png",2)
texture(1)=LoadTexture("fire1.png",2)
While Not KeyHit(1)
If KeyDown(2) Then Gosub createexplosion
Gosub updateexplosion
UpdateWorld
RenderWorld
Text 0,0," tris="+TrisRendered()
Flip
Wend
End
.updateexplosion
For e.explosion=Each explosion
e\scale=e\scale+4
ScaleEntity e\entity,e\scale,e\scale,e\scale
TurnEntity e\entity,3,3,3
If e\scale=>250 Then FreeEntity e\entity:Delete e.explosion
Next
Return
.createexplosion
e.explosion=New explosion
e\entity=CopyEntity(explode)
EntityTexture e\entity,texture(Int(Rnd(0,1)))
PositionEntity e\entity,0,0,0
TurnEntity e\entity,Rnd(0,359),Rnd(0,359),Rnd(0,359)
e\scale=0.1
ScaleEntity e\entity,e\scale,e\scale,e\scale
Return
.setup
Type explosion
Field x,y
Field entity
Field scale#
End Type
Return
press 1 to generate explosions. you'll need to have 2 textures named fire and fire1 both in png format for it to work. anyone got any ideas??
|