I have currenlty have a game where it creates objects every 5 secs and each object has different color how do i print the rgb value of the object when it is pressed
Here is my current code
local ragdogLib = require "ragdogLib"; function randomcolor() local colors = { "#e67e22","#e74c3c" ,"#f1c40f","#1abc9c","#8e44ad" } local finalcolor = colors[math.random(1, 5)] return finalcolor
local function addnewobject() local bombstartnew = display.newRect( startingpoint, -340, 50, 50) red, green, blue = ragdogLib.convertHexToRGB(randomcolor()) bombstartnew.fillColor = {red, green, blue} bombstartnew:setFillColor( unpack(bombstartnew.fillColor) ) print(unpack(bombstartnew.fillColor)) end
Thanks