Hello,
I have different numbers in my app that generate randomly. There’s one number on the top of the simulator, you then have three different numbers on the bottom of the simulator that you need to add, subtract, multiply and divide to get the answer on the top. You basically need to use the numbers on the bottom to get to the top number.
I have provided code on below that you can copy paste to further see what i mean.
I have generated the random numbers and have the all the numbers showing, when you click on the bottom numbers they becoming darker. But what i don’t know how to do is say, if you click on let’s say 2 numbers those too numbers will add together and be the new score on the bottom of the screen…etc. Same with multiplying,subtracting dividing. So for further clarification, i need to know how i would be able to click on the numbers, then the numbers that you have clicked on have added together. The two numbers that you have added together will be the final score on the furthest bottom of the screen.
Thanks! I really appreciate help! If you do not understand please contact me!
- Michael
The code:
[code]
limit = math.random(50,800)
local scoreTxt = display.newText("",150,150,“Cartoon”,20)
limit2 = math.random(1,50)
local scoreTxt2 = display.newText("",150,300,“Cartoon”,20)
limit3= math.random(1,50)
local scoreTxt3 = display.newText("",200,300,“Cartoon”,20)
limit4 = math.random(1,50)
local scoreTxt4 = display.newText("",100,300,“Cartoon”,20)
randNum = true
local function moveHeavens(e)
scoreTxt.text = limit
if randNum == true then
if randNum == false then
end
end
end
Runtime:addEventListener(“enterFrame”, moveHeavens )
randNum2 = true
local function moveHeavens2(e)
scoreTxt2.text = limit2
if randNum2 == true then
if randNum2 == false then
end
end
end
Runtime:addEventListener(“enterFrame”, moveHeavens2 )
randNum3 = true
local function moveHeavens3(e)
scoreTxt3.text = limit3
if randNum3 == true then
if randNum3 == false then
end
end
end
Runtime:addEventListener(“enterFrame”, moveHeavens3 )
randNum4 = true
local function moveHeavens4(e)
scoreTxt4.text = limit4
if randNum4 == true then
if randNum4 == false then
end
end
end
Runtime:addEventListener(“enterFrame”, moveHeavens4 )
function PressRan()
limit = math.random(100,500)
end
scoreTxt:addEventListener(“tap”, PressRan)
function PressAlpah2()
scoreTxt2.alpha = 0.4
itDoes = true
end
scoreTxt2:addEventListener(“tap”, PressAlpah2)
function PressAlpah3()
scoreTxt3.alpha = 0.4
itDoes = true
end
scoreTxt3:addEventListener(“tap”, PressAlpah3)
function PressAlpah4()
scoreTxt4.alpha = 0.4
itDoes = true
end
scoreTxt4:addEventListener(“tap”, PressAlpah4)
fScore = 0
local scoreTxt5 = display.newText("",150,400,“Cartoon”,20)
local function moveHeavens5(e)
scoreTxt5.text = fScore
if itDoes == true then
if itDoes == false then
end
end
end
Runtime:addEventListener(“enterFrame”, moveHeavens5 )
[import]uid: 23689 topic_id: 21061 reply_id: 321061[/import]


