In my app there are three thresholds each with a different multiplier assigned to it.
So when you shoot the bullet depending on where the balloon is popped, that is what the score will be multiplied by.
Code for thresholds:
thresholds[1]=display.newRect(0,0,768,200) --This is the region with 5x multiplier thresholds[2]=display.newRect(0,0,768,60) --This is the region with 10x multiplier thresholds[3]=display.newRect(0,0,768,260) --This is the region with 1x multiplier thresholds[1]:setFillColor(math.random(0, 255)/255, math.random(0, 255)/255, math.random(0, 255)/255) thresholds[2]:setFillColor(math.random(0, 255)/255, math.random(0, 255)/255, math.random(0, 255)/255) thresholds[3]:setFillColor(math.random(0, 255)/255, math.random(0, 255)/255, math.random(0, 255)/255) thresholds[1].x=\_W/2 thresholds[1].y=\_H-(thresholds[1].height+112) thresholds[2].x=\_W/2 thresholds[2].y=(\_H-thresholds[1].height-243) thresholds[3].x=\_W/2 thresholds[3].y=\_H+(thresholds[3].height\*.5-210) txt1=display.newText("1x",500, 500, native.systemFontBold, 30 ) txt1.x=\_W-50 txt1.y=\_H-150 txt2=display.newText("5x",100, 200, native.systemFontBold, 30 ) txt2.x=\_W-50 txt2.y=\_H-350 txt3=display.newText("10x",100, 200, native.systemFontBold, 30 ) txt3.x=\_W-50 txt3.y=\_H-452
To assign the multiplier for each threshold i do this:
for i=1,#thresholds do thresholds[i].boundary=math.ceil(thresholds[i].y+(thresholds[i].height\*.5)) if (i==3) then thresholds[i].multiplier=1 elseif (i==2) then thresholds[i].multiplier=10 else thresholds[i].multiplier=5 end end
The multiplier for my 3rd and 1st threshold (so the 1x and 5x multiplier) work but when i pop a balloon in the x10 region/threshold[2] the multiplier is 1 not 10. Why is this?