local cx = display.contentCenterX
local cy = display.contentCenterY
local background = display.newImageRect("images/menulis/background.png", 1160/2, 720/2)
background.x = cx
background.y = cy
background:setReferencePoint(display.CenterReferencePoint)
local kotak = display.newImageRect("images/menulis/kotak.png", 196/2, 152/2)
kotak.x = cx - 187
kotak.y = cy
local kotakTombol = display.newImageRect("images/menulis/kotakTombol.png", 133/2, 528/2)
kotakTombol.x = cx + 203
kotakTombol.y = cy
local hurufKanji = display.newImageRect("images/menulis/katakana/a.png", 582/2, 606/2)
hurufKanji.x = cx + 15
hurufKanji.y = cy
local pancing = display.newImageRect("images/menulis/tangan.png", 125/2, 168/2)
pancing.x = 30
pancing.y = 30
pancing.xScale = 0.8
pancing.yScale = 0.8
pancing.rotation = -8
tanda = {}
posisiTanda = {{0},
{0}}
for i = 1, 1 do
tanda[i] = display.newImageRect("images/menulis/tandaTulis.png", 38/2, 34/2)
tanda[i].x = posisiTanda[1][i]
tanda[i].y = posisiTanda[2][i]
end
local function klik(e)
if e.phase == "began" then
display.getCurrentStage():setFocus(e.target)
elseif e.phase == "moved" then
pancing.x = e.x
pancing.y = e.y
c = pancing.x
d = pancing.y
elseif e.phase == "ended" then
print("Koor X : ", c)
print("Koor Y : ", d)
end
end
pancing:addEventListener("touch", klik)
No comments:
Post a Comment