couleurGoutteSol.a = couleurGoutteSol.a - 10
I do not understand why this line changes the alpha value in the table. gouttesSolTableau
ellipse(x,y,taille)
I do not understand why this line draw many ellipse i aske it only one time.
I want only one ellipse at the end
--# GoutteSol
--goutteSol
GoutteSol = class()
function GoutteSol:init(x,y,taille,couleur)
self.position = vec2(x,y)
self.taille = taille
self.couleur=couleur
end
function GoutteSol:draw()
for numGS,cetteGoutteSol in pairs(gouttesSolTableau) do
dessinerGoutteSol(numGS)
end
end
function creerGoutteSol(x2,y2)
local taille=200
local couleur=color(0, 155, 255, 255)
couleur.a=100
maGoutteSol=GoutteSol(x2,y2,taille,couleur)
table.insert(gouttesSolTableau,maGoutteSol)
end
function dessinerGoutteSol(numGoutteSol)
local x=gouttesSolTableau[numGoutteSol].position.x
local y=gouttesSolTableau[numGoutteSol].position.y
local taille=gouttesSolTableau[numGoutteSol].taille
local couleurGoutteSol=gouttesSolTableau[numGoutteSol].couleur
local pas = 30
local nbCercle=math.floor(taille/pas)
local tailleCercle=taille-nbCercle*pas
for i=1, nbCercle do
fill(couleurGoutteSol)
ellipse(x,y,tailleCercle) $$$$$$$$$$$$$$$$$$$$$$
tailleCercle = tailleCercle + pas
**couleurGoutteSol.a = couleurGoutteSol.a - 10 **
end
for i=1, nbCercle do
couleurGoutteSol.a = couleurGoutteSol.a + 10
end
noStroke()
stroke(255, 0, 6, 255)
strokeWidth(2)
** ellipse(x,y,taille) **
end
--# Main
-- main
function setup()
-- displayMode(FULLSCREEN)
game =false
-- variables de départ
gouttesSolTableau={}
end
function draw()
supportedOrientations(PORTRAIT)
cameraSource(CAMERA_BACK)
sprite( CAMERA, WIDTH/2, HEIGHT/2,-WIDTH,-HEIGHT)
GoutteSol:draw()
end
function touched(touch)
if CurrentTouch.state==BEGAN then
creerGoutteSol(CurrentTouch.x,CurrentTouch.y)
end
end