I think he has a background image with different shapes of different sizes, and when he clicks on a certain shape he wants it to setFillColor to a specific color.
Depending on what shapes you have on your background image you may or may not be able to do it with simple squares or circles. In case your shapes are more complicated than your normal shapes you might have to use a program like PhysicsEditor, otherwise if it’s only polygon’s or simple stuff check out this link on how to create custom collision models:
http://developer.anscamobile.com/content/game-edition-physics-bodies#Complex_body_construction
Here is sample code on how it’d work for simple shapes.
local square = display.newRect( 50,50,50,50 )
local circle = display.newCircle( 150,150,50 )
local function changeColor( event )
if event.phase == "began" then
object = event.target
end
if event.phase == "ended" or event.phase == "cancelled" then
if object == circle then
object:setFillColor(255,0,0)
elseif object == square then
object:setFillColor(0,255,0)
end
end
end
square:addEventListener( "touch", changeColor )
circle:addEventListener( "touch", changeColor )
[import]uid: 77199 topic_id: 27484 reply_id: 111998[/import]