Swipe limitation - any ideas?

Can’t fathom how to limit swipe on a game without black background showing/bleeding in.

Same as ‘Ghosts vs. Monsters’ - when you swipe to the next screen, if you swipe too far, then the black background bleeds in.

Basically looking to limit the swipe so that it stops at the edge of the gaming background. The limitation probably needs to be put into this section of code (from level1.lua in Ghosts vs. Monsters). . .
if canSwipe == true then

if screenPosition == “left” then
– Swipe left to go right
if event.xStart > 180 then
gameGroup.x = event.x - event.xStart

if gameGroup.x > 0 then
gameGroup.x = 0
canSwipe = true
end
end

elseif screenPosition == “right” then
– Swipe right to go to the left
gameGroup.x = (event.x - event.xStart) - 480

if gameGroup.x < -480 then
gameGroup.x = -480
canSwipe = true
end
end

end
end
end
Any ideas or pointers would be appreciated as I’m still quite new to Corona. Right now I’ve hit a brick wall with this.

In the meantime, if I find a solution I’ll update this post. [import]uid: 12941 topic_id: 10394 reply_id: 310394[/import]

I had/have the same problem, I am in the next step of your problem. So right now, you are at the point of it just swiping left to right. What you need to do is limit how far your gameGroup can move. So lets say your gameGroup is bounded between x = -300 and x = 0(when the screen is on the right x should be negative.). So every time it is moved you have to check if your gameGroup’s x will be out of bounds, if so set that gameGroup’s x to that boundary. Now you have a limited amount you can swipe. YEAH !!!
Next is easy all you have to do now is create a background/stage with extra width so you don’t get any bleed no matter what device you are on. Depending on how your config file is set up, an extra 100 pixels should be plenty. Plus the longer the stage the greater the effect of motion parallax imo. So set the gameGroup.x = -100 or something as a starting position.
Now here is where I am stuck at, after this you will have no bleed no matter what device you are on (I don’t on the android devices). But now you will have a scaling issue which lies within your config file, width wise the game is inconsistent between devices. So thinking ahead you and I are stuck if we want our UI elements to stick in those far right corners.
Oh, I should have said this earlier, you might want to make your own separate swipe function, that giant touch function is too crowded imo. [import]uid: 54716 topic_id: 10394 reply_id: 37922[/import]

Thank you for your reply and advice ir8pritmates,

I will try this and anything new/extra I encounter I’ll post here.

Your advice about the gameGroup boundaries is really interesting and useful advice. I will try this.

Thanks again buddy. [import]uid: 12941 topic_id: 10394 reply_id: 38187[/import]