I thought this would've been straightforward to so but unfortunately I can't seem to get it to work. I'm adding two or more bitmaps to one sprite like the code below. But only the first gets centered properly. Not the subsequent ones. Why is that. What am I missing here?
Why isn't the lock bitmap centered like the btn Bitmap is?
local Button1 = Sprite.new()
local btn_p = mydata.Base:getTextureRegion("Level_Btn.png")
local btn = Bitmap.new(btn_p)
btn:setColorTransform(129/255,129/255,129/255)
Button1:addChild(btn)
local lock = mydata.Base:getTextureRegion("gameBLock.png") ,
local lock = Bitmap.new(lock)
lock:setColorTransform(255/255,129/255,129/255)
Button1:addChild(lock)
<span class="sy0"><</span>img src<span class="sy0">=</span><span class="st0">"http://forum.giderosmobile.com/uploads/editor/1m/gwjsu82y515o.png"</span> alt<span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/></span> |
|
Comments
Your code is a little messy, for example : You are using the same name for the variable! + there is a comma at the end of the line!
To center both images you can try the setAnchorPoint(0.5, 0.5) for both your buttons.
Some sample code:
Peace.
Likes: MoKaLux, antix