タッチしたらそこにマップが移動するやつ
map
isTouching=false
centerPosition={}
touchPosition={}
function onTick()
local rangeScale,height,width,touchX,touchY,isTouch
rangeScale=input.getNumber(8)
zoom=rangeScale/1000 --display range
gpsPosition={x=input.getNumber(9),y=input.getNumber(10)} --position of vehicle
--touch screen
isTouch=input.getBool(1)
if isTouch and not(isTouching) then
width=input.getNumber(1)
height=input.getNumber(2)
touchX=input.getNumber(3)
touchY=input.getNumber(4)
isTouching=true
touchPosition.x,touchPosition.y=map.screenToMap(centerPosition.x, centerPosition.y, zoom, width, height, touchX, touchY) --world position of touch
end
--Center coordinates
if next(touchPosition) then
centerPosition=touchPosition
else
centerPosition=gpsPosition
end
--flag
if not(isTouch) and isTouching then
isTouching=false
end
isReset=input.getBool(2)
if isReset then
touchPosition={}
end
end
function onDraw()
--position = World XY , pixel = Display XY
local width,height
local gpsPixel={}
width=screen.getWidth()
height=screen.getHeight()
screen.drawMap(centerPosition.x, centerPosition.y, zoom) --drawring map
gpsPixel.x,gpsPixel.y=map.mapToScreen(centerPosition.x, centerPosition.y, zoom, width, height, gpsPosition.x, gpsPosition.y) --Location of the vehicle
screen.drawCircle(gpsPixel.x,gpsPixel.y,5)
end