Damn these types!!

Blitz3D Forums/Blitz3D Beginners Area/Damn these types!!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You don't really need to make "snow" global. The 100 type objects you're creating are being created, then dereferenced, but they still exist.

You can still step through all the particles you've created if they don't have independant variables referencing them, like at the bottom here:


Type Particles
Field x#, y#, z#
Field xdelta#, ydelta#, zdelta#
Field image
End Type

Global snowspriteimage = LoadSprite("snow.bmp",15);
hideentity(snowspriteimage) ; <== Hide the sprite you just loaded -- it's going to stay put

For j=1 To 100
snow.Particles = New Particles
snow\x# = Rand(-50, 10);
snow\y# = 50;
snow\z# = Rand(75, -75)
snow\xdelta# = Rnd(-0.2, 0.2)
snow\ydelta# = -0.1 + Rnd(-1.0)
snow\zdelta# = -0.1+Rnd(-0.1, 0.01)
snow\image = CopyEntity(snowspriteimage)
SpriteViewMode snow\image, 1
RotateEntity(snow\image, 90 , 0 , 0)
PositionEntity snow\image, snow\x, snow\y, snow\z
EntityColor snow\image, 255,0,0
Next 

While (1)
  For particle.Particles = Each Particles
    TranslateEntity(particle\image, particle\xdelta, particle\ydelta, particle\zdelta)
  Next
  UpdateWorld()
  RenderWorld()
  Flip()
Wend