Hi,
Please I like to know if somebody has tried to change the drag move of a RPG map to a scroll move, or know how to do that?
Thanks
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Hi,
Please I like to know if somebody has tried to change the drag move of a RPG map to a scroll move, or know how to do that?
Thanks
Do you mean to drag the map around by touch? If so, try this:
1 2 3 4 5 | local onTouch = function( event ) map:drag( event ) end Runtime:addEventListener( "touch", onTouch ) |
Hi Grahan,
Thanks the quick answer, but what I want is to change this "map:drag(event) " movement, by using the scrollView.lua library of Corona, which have the " stopping delayed" effect.
you must try to change the part of the code responsible for moving the map, so instead of following your finger, it moves in a direction relative to the starting point (when you clicked)
I tried to put a lime map in the scrollView sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | display.setStatusBar( display.HiddenStatusBar ) --import the scrolling classes local scrollView = require("scrollView") -- Setup a scrollable content group local topBoundary = display.screenOriginY local bottomBoundary = display.screenOriginY local scrollView = scrollView.new{ top=topBoundary, bottom=bottomBoundary } system.activate( "multitouch" ) local lime = require("lime") local map = lime.loadMap("tutorial16.tmx") local player = nil local onPlayerCreate = function(property, type, object) player = object end map:addPropertyListener("IsPlayer", onPlayerCreate) lime.createVisual(map) lime.buildPhysical(map) scrollView:insert(map) -- Important! Add a background to the scroll view for a proper hit area local scrollBackground = display.newRect(0, 0, display.contentWidth, scrollView.height+64) scrollBackground:setFillColor(255, 255, 255) scrollView:insert(1, scrollBackground) scrollView:addScrollBar() map:setFocus(player.sprite) local onUpdate = function(event) map:update(event) end Runtime:addEventListener("enterFrame", onUpdate) |
I'm replying on my phone so sorry for the short reply, try inserting map.world rather than just map.
Hey Graham, is working now, let me try to insert the map I wanna.
Thanks again, this is a great support to your costumer, see you in the next doubt.
No worries, very happy to help.