hi all,
i’m starting out with the code and just trying out random code behavior
currently if the thing is being moved i want it to detect that the touch is being moved backwards
however, it never detects it.
the following is the code
local textObject = display.newText( "Hello World!", 50, 50, native.systemFont, 24 )
textObject:setTextColor( 255,255,255 )
local height = "Max height " .. display.viewableContentHeight
local width = "Max width " .. display.viewableContentWidth
local infoa = display.newText( height , 50, 300, native.systemFont, 24 )
infoa:setTextColor(255,255,255)
local infob = display.newText( width , 50, 400, native.systemFont, 24 )
infob:setTextColor(255,255,255)
local displaylocation = function (event)
local origx
local origy
local midx = display.viewableContentHeight / 2
local midy = display.viewableContentWidth / 2
if event.phase == "began" then
if (origx == nil) then
origx = event.x
end
textObject.text = ("X: " .. event.x .. " Y: " .. event.y)
infoa.text = ("in began phase")
infob.text = ("origx is " .. origx)
end
if event.phase == "moved" then
textObject.text = ("MX: " .. event.x .. " MY: " .. event.y)
infoa.text = ("in moved phase")
if (origx \> event.x) then
infob.text = ("Morigx is " .. origx)
end
end
end
Runtime:addEventListener("touch",displaylocation)
does anybody know the following code never happens?
if (origx \> event.x) then
infob.text = ("Morigx is " .. origx)
end
[import]uid: 131583 topic_id: 22942 reply_id: 322942[/import]