Reputation: 187
I created an Image here:
gangster = display.newImageRect("assets/gangsta.png", gangsterwidth, gangsterheight)
gangster.x = display.contentCenterX
gangster.y = 950
sceneGroup:insert(gangster)
And I want to scale the Image now after I set it here:
local function enterFrameListener()
if holding then
if ( touchx < gangster.x) then
gangster.x = gangster.x - 10
end
if ( touchx > gangster.x) then
gangster.x = gangster.x + 10
end
if ( touchy > gangster.y) then
gangster.y = gangster.y + 10
-- INCREASE HEIGHT AND WIDTHHERE
end
if ( touchy < gangster.y) then
gangster.y = gangster.y - 10
gangsterheight = gangsterheight -5
-- DECREASE HEIGHT AND WIDTH HERE
end
if (touchx == gangster.x) then
if (touchy == gangster.y) then
Runtime:removeEventListener( "enterFrame", enterFrameListener)
holding = false
end
end
else
end
end
But how do I do this?
Upvotes: 0
Views: 78
Reputation: 322
Display objects have a scale method. In your case, you should just be able to do
gangster:scale(0.5,0.5) -- half the size
Upvotes: 2