Hello everybody,
it’s my first post, I hope my english is comprehensible.
I recently subscribed to Dynamics Shader (porkfin software). It is really simple as it was described. There is only one problem.
I can only use just one light, if I try to activate more than one no error message appears, I see the newImageRects of all the lights but only the first one work.
Is it my mistake or is it a limitation of the plug-in?
I am writing an excerpt from the code.
.... .... physics.start( ) physics.setGravity( 0, 0) DynamicShaderIsON = true -- just restarting background -------- LayoutScacchiera = "marmo" TipoScacchieraOld = 0 InizializzaScacchiera () local movement, lighting = shader.getMovement() debugLevel = shader.setDebugLevel(0) local N , angolo local objectPhysics = off -- set to false to turn off physics local objectMotion = off -- turns on slight motion for physics objects ----- Define the light source ----- angolo = 0 for N = 1, 3, 1 do angoloLuce[N] = angolo angolo = angolo + 120 light[N] = display.newImageRect( "immagini/light.png", 50, 50 ) light[N].x = centroLuce.x + math.sin(math.rad(angoloLuce[N])) \* raggioLuce light[N].y = centroLuce.y + math.cos(math.rad(angoloLuce[N])) \* raggioLuce local lightColor = {1, 1, 1} light[N]:setFillColor(lightColor) -- this is the default color ----- Add the light source to the Dynamic Shader ----- shader.addLight(light[N]) shader.setLightColor(lightColor) end -- for N = 1 , 3 ----------------------------------------------------------------------------------- local croce = display.newImageRect( "immagini/croceRock.png", 50, 50 ) croce.x = cx + 90 ; croce.y = cy - 90 croce.shaderInfo = {name = "croce", map1 = "immagini/croceRock.png", map2 = "immagini/croceRock\_n.png"} shader.addObject(croce) ----------------------------------------------------------------------------------- local cerchio = display.newImageRect( "immagini/cerchioRock.png", 50, 50 ) cerchio.x = cx - 105 ; cerchio.y = cy + 50 -- shaderInfo table required for the Dynamic Shader cerchio.shaderInfo = {name = "cerchio", map1 = "immagini/cerchioRock.png", map2 = "immagini/cerchioRock\_n.png"} -- add object to the Dynamic Shader shader.addObject(cerchio) ----------------------------------------------------------------------------------- ----- START THE DYNAMIC SHADER ----- ----------------------------------------------------------------------------------- shader.start() -- start shading luceDynamicShader = timer.performWithDelay(20, luceDynamicShader, -1 ) .... .... local function luceDynamicShader() local N =0 raggioLuce = 100 local cx, cy = display.contentCenterX, display.contentCenterY for N = 1 , 3 , 1 do angoloLuce[N] = angoloLuce[N] + 4 if angoloLuce[N] \> 360 then angoloLuce[N] = angoloLuce[N] - 360 end light[N].x = centroLuce.x + math.sin(math.rad(angoloLuce[N])) \* raggioLuce light[N].y = centroLuce.y + math.cos(math.rad(angoloLuce[N])) \* raggioLuce end -- for N = 1 , 3 end --local function timerLuceFaro()
As you can see there are three lights that rotate around a “centroLuce” center each at 120 ° from each other at a distance equal to “raggioLuce”.
In function luceDynamicShader () I simply spin the three lights.
Anyone have an idea?
Thannks in advance,
Alessio