Image Corona:如何在我创建图像后缩放它

Image Corona:如何在我创建图像后缩放它,image,lua,scale,coronasdk,Image,Lua,Scale,Coronasdk,我在这里创建了一个图像: gangster = display.newImageRect("assets/gangsta.png", gangsterwidth, gangsterheight) gangster.x = display.contentCenterX gangster.y = 950 sceneGroup:insert(gangster) 在这里设置后,我现在要缩放图像: local function enterFrameListener() if holding th

我在这里创建了一个图像:

gangster = display.newImageRect("assets/gangsta.png", gangsterwidth, gangsterheight)
gangster.x = display.contentCenterX
gangster.y = 950
sceneGroup:insert(gangster)
在这里设置后,我现在要缩放图像:

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
本地函数enterFrameListener()
如果是的话
如果(touchxganster.x)那么
匪徒.x=匪徒.x+10
结束
如果(touchy>gongster.y)那么
匪徒.y=匪徒.y+10
--在此处增加高度和宽度
结束
如果(多愁善感<歹徒.y)那么
匪徒.y=匪徒.y-10
匪徒高度=匪徒高度-5
--在此降低高度和宽度
结束
如果(touchx==ganster.x),那么
如果(touchy==gongster.y)那么
运行时:removeEventListener(“enterFrame”,enterFrameListener)
保持=错误
结束
结束
其他的
结束
结束

但是我该怎么做呢?

显示对象有一个缩放方法。在你的情况下,你应该能够做到

gangster:scale(0.5,0.5) -- half the size

显示对象具有缩放方法。在你的情况下,你应该能够做到

gangster:scale(0.5,0.5) -- half the size

天哪,我太傻了,我总是用:而不是。非常感谢。天哪,我太傻了,我总是用:而不是。非常感谢。