A video showing the included examples and some features of the G2D library
YouTube video
/**** EXAMPLE 01 *********************
* Using Particle System with Layers *
*************************************/
; Enable the layers system
EnableLayers()
; Create a Sprite Engine
Local se = pSpriteEngine:Create()
; Disable Y Sprite Sorting
se:YSort_Set(False)
; Load 2 brush we will use as particle for the first system (ps)
Local bid1 = LoadBrush(Nil, "resources/blob.png", { LoadAlpha = True })
Local bid2 = LoadBrush(Nil, "resources/blib.jpg")
; Now we create 3 particle systems
Local ps = ParticleSystem:New(se, 0, { x = 400, y = 300, Rate = 40, Quantity = 1 }, { y = 0.01, Velocity = 0.01 }, { Brushes = True, Items = { bid1, bid2 } }, { Life = 3000, LifeVar = 2000, Scale1 = 1, Scale2 = 0.1 }, 15, True, True)
Local ps2 = ParticleSystem:New(se, 1, { x = 250, y = 300, Rate = 9, Quantity = 1 }, {}, { Brushes = False, Items = { "resources/blib.jpg" } }, { Life = 2000, AngleVar = 40, Angle = 10, Roto1 = 20, Roto2 = 90, Scale1 = 1, Scale2 = 5 }, 20, True, True)
Local ps3 = ParticleSystem:New(se, 2, { x = 150, y = 300 }, {}, { Brushes = False, Items = { "resources/nuvola.png" } }, { Life = 1000 }, 10, True, True)
; This interval is needed to update constantly the particles
Local rendering = SetInterval(Nil,
Function()
; Attach one particle system to the mouse pointer
ps.Emitter.x = MouseX()
ps.Emitter.y = MouseY()
; Updates all defined sprites
se:All_DrawUnorderedInv()
EndFunction , 15)
; Wait for events until ESC key is pressed
While Not(IsKeyDown("ESC"))
WaitEvent()
Wend
.MakeGradient(colorlist, steps)
.MakeCopperBar(params)
.MakeGradientTable(colorlist, steps)
:new()
:init(params)
:setClearColor(ARGB)
:draw()
:objectAdd(object)
:objectRemove(object, free)
:objectCleanup()
:objectSwap(object1, object2)
:stackPushUp(object)
:stackPushDown(object)
:stackShiftUp()
:stackShiftDown()
:new(params)
:draw()
:new(params)
:update() - called by :draw()
:draw()
:free()
:new(params)
:free()
:new(params)
:draw()
:new(params)
:draw()
:new(params)
:clean()
:hsplit(size) Return a table of brush objects
:vsplit(size) Return a table of brush objects
:hvsplit(size) Return a table (matrix) of brush objects
:free()
:new(params)
:draw()
:free()
:new(params)
:draw()
:new(engine, params, objList)
:draw()
:free()
:new(params)
:draw()
:new(params)
:draw()
:free()
:new(params)
:draw()
:new()
:draw()
:free()
:new(params)
:draw()
:new(params)
:draw()
:new(params)
:draw()
:free()
Users browsing this forum: No registered users and 1 guest