The idea is to expand a little initial reference: when the yellow square touches other objects, they take their color.
This is the complete code with your erroneous line:
Objeto1=display.newRect (100,50,25,25) Objeto1:setFillColor (1,0,0) Objeto2=display.newRect (200,150,25,25) Objeto2:setFillColor (0,1,0) Objeto3=display.newRect (300,250,25,25) Objeto3:setFillColor (1,0,1) Objeto4=display.newRect (400,350,25,25) Objeto4:setFillColor (0,1,1) Objeto5=display.newRect (500,450,25,25) Objeto5:setFillColor (1,0,0) opcionesinfo={ text="", x=650, y=300, width=300, height=300, font= "Droid Sans Mono", fontSize=24, align= "center", } info= display.newText(opcionesinfo) info :setTextColor(1,0,0) Objetos={Objeto1.x,Objeto2.x,Objeto3.x,Objeto4.x,Objeto5.x} Objetos2={Objeto1.y,Objeto2.y,Objeto3.y,Objeto4.y,Objeto5.y} local circle = display.newRect( 50, 50, 25,25 ) circle:setFillColor( 1, 1, 0 ) local function moveCircle( event ) circle.x = event.x circle.y = event.y for barrer=1,5 do if ((math.abs (circle.x-(Objetos[barrer]))\<25) and (math.abs (circle.y-(Objetos2[barrer]))\<25)) then -- Next line is wrong Objetos[barrer]:setFillColor (1,1,0) info.text= barrer break else info.text= "No hay contacto" end end end Runtime:addEventListener( "touch", moveCircle )