2016-04-10 9 views
0
私はここに画像作成

コロナ:私はそれを作成した後の画像を拡大縮小する方法を

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 

しかし、どのように私はこれをするのですか?

答えて

2

表示オブジェクトにはスケール方法があります。あなたのケースでは、あなただけができるはずです

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

Omg私はいつも鍛造しています。 。ありがとうございました! – AlGrande

関連する問題