Local variable chaging global variable. Probleme.....

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

About the many ellipses… Try to use background then the ellipse problem as I think it is will be solute

colorgoutasoil, or how else it is called, can be used by one value because you are editing color or grey value try to use fill(coleurGottaSoul, coleurGottaSoul, coleurGottaSoul, 255) because then you will get red,green,blue.

I think this is what you mean…

@franck
With the alpha issue, this is because color objects are stored in tables, and in Lua, if you say tableA = tableB you are not making an independent copy of the table, you are just creating a pointer, or alias to the table. So changing an elements in either tableA or tableB will be making the change in the same table. With colors, you can see this here:

    a = color(0,0,0)
    b = a --not a copy, just a pointer
    c = color(a.r, a.g, a.b) --an independent copy
    a.g = 200 
    print(a,b,c) --prints: (0, 200, 0, 255)	(0, 200, 0, 255)	(0, 0, 0, 255)

The dessinerGoutteSol function looks like it should be a method of the GoutteSol class. Then you could just use the self variable instead of defining all those local versions of the variables, and you wouldn’t run into issues like this one, of having to make independent copies of tables.

I do not want a background color i want the camera as the background.
I do not want to change the r,g,b i juste want to change the alpha…

@franck - you are drawing many ellipses because you have two ellipse commands, one of them inside a loop. Look at your code above, I have marked that line with $$$$$$$$$$ to show you.