most of what i see in numbertap is pretty simple. all of your keys can be done graphically and assign each key a ID and a event listener.
[lua]
homeIcon = display.newImageRect( “images/common/back1.png”, 145, 145,true ) – 145,145 is the x and y of the graphic
homeIcon.x = (homeIcon.width/2)+(200) – image displays off the centerpoint by default
homeIcon.y = ((homeIcon.height/2))+(200)
homeIcon.alpha = 1
homeIcon.ID = “key1” – Self assigned key ID to be used in the listener
homeIcon:addEventListener( “touch”, buttonAction )
[/lua]
So make one of those for each key they will press.
here is a event listener to use with it
[lua]
function buttonAction(event)
if event.phase == “began” then
if event.target.ID == “key1” then
– Do something for key1 on the began phase of the touch evennt. like show a highlight color
end
end
if event.phase == “ended” or event.phase == “released” then
if event.target.ID == “key1” then
--Do something when they release the key. this is where you would determin if you want to show what they hit or add a value to something else…
end
end
end
[/lua]
you can render the math problem itself with just a display text option as well with something like this:
[lua]
local textToDisplay = “hello there”
local line1a = display.newText(textToDisplay, 1,1, “Helvetica”, 48 )
line1a.x = 100
line1a.y = 100
line1a:setTextColor(255,255,255)
[/lua]
and after you display the text, if you want to change its displayed value later (after they hit a key)
[lua]
line1a.text = “new text to display” – and it will update the text its displaying
[/lua]