Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Change rect position horizontally with for loop?
Started by KilikSky Nov 09 2016 12:53 AM

No replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

KilikSky

[GLOBAL: userInfoPane.html]
KilikSky
  • Enthusiast

  • 81 posts
  • Corona SDK

How will i able to make the 3 box became horizontally and are aligned together since its vertical?  see the pic below


local _W = display.contentWidth
local _H = display.contentHeight
 
 
local areaPadding = 12
local topPadding = 16
local answerOffset = 6
local area = answer_rect.height - (areaPadding*2.5)
local answerHeight = (area-topPadding-(answerOffset*#q.answers))/#q.answers
local textX = numberX + 20
local textW = _W - textX - 24
 
for i=1, #q.answers do
local y = answer_rect.y + areaPadding + topPadding + ((answerHeight+answerOffset)*(i-1))
 
local rect = display.newRect(quizGroup, _W*0.5, y , _W*0.5, answerHeight)
rect.anchorY = 0
rect.id = "answer"
rect.index = i
rect:setFillColor(0.1)
rect:addEventListener("touch", buttonTouched)

end

Attached Files




[topic_controls]
[/topic_controls]