scrollView widget related question

Ive been wondering if its possible to set up a few things using ScrollView widget for my game and wanted to see if these are possible, and if not, what solutions do I have for achieving these. 

  1. Is there a way to make the scrollView loop itself so that it acts like an infinite loop? Basically imagine 3 objects inside the scrollview, can i set it so that what ever is scrolled off screen instantly appears behind the last.

  2. Is there a way to make the scrollView not snap back when the player releases their finger? Instead it should stay where the player let go

  3. Can ScrollView objects play with collisions from others colliding with it ? 

Thanks guys 

I appreciate any thoughts on this. 

I really don’t think a scrollview is really suited to the task. I’m sure you could bend it to your will as described, but it’s far easier to roll your own looping scroller.

Basically, you would simply check the y value of your objects for offscreenness and set the y value relative to the object you want to place it above or at the top of the screen etc.

Collisions, as long as you’re not relying on physics based ‘internal’ collisions, are basically a case of manually checking relative positions and sizes to test for overlap, so I guess you can have scrollview objects interact with other objects if you really wanted, but handling the result (animation, destruction etc) of the collision of the stuff in the scrollview is likely to be a lot less straightforward than managing the objects outside it.

  1. Can a scrollView loop? No. This is not an out of the box feature. Perhaps what you could do is if the scrollView’s data is twice the size of the viewPort, you could detect when scrolling was reached and do a zero animation jump to content position 0. As long as it happens in the same frame and the background is seamless it might provide the illusion. But this is certainly not a game “camera” tool.

  2. Can you have it not “snap back”. Yes, see: https://docs.coronalabs.com/api/library/widget/newScrollView.html#isbounceenabled-optional

  3. At the end of the day, a scrollView’s underlying structure is a display.newGroup(). There are rules on having some physics bodies in multiple groups that would be impacted.

Rob

Thanks for the replies guys, appreciate the help. 

@JWiow: I was thinking about using a looping scroller to do this but I am not sure it would of worked the way Intended since the player can move freely left and right. I was worried that the animation might get caught up after a few quick rapid moves. 

@Rob Miracle: That trick with the viewport might be worth a try. When you mention ‘viewport’ do you mean the scrollView length? Would it be possible to show me roughly how you would check against that value and perform the jump? 

Cheers

I appreciate any thoughts on this. 

I really don’t think a scrollview is really suited to the task. I’m sure you could bend it to your will as described, but it’s far easier to roll your own looping scroller.

Basically, you would simply check the y value of your objects for offscreenness and set the y value relative to the object you want to place it above or at the top of the screen etc.

Collisions, as long as you’re not relying on physics based ‘internal’ collisions, are basically a case of manually checking relative positions and sizes to test for overlap, so I guess you can have scrollview objects interact with other objects if you really wanted, but handling the result (animation, destruction etc) of the collision of the stuff in the scrollview is likely to be a lot less straightforward than managing the objects outside it.

  1. Can a scrollView loop? No. This is not an out of the box feature. Perhaps what you could do is if the scrollView’s data is twice the size of the viewPort, you could detect when scrolling was reached and do a zero animation jump to content position 0. As long as it happens in the same frame and the background is seamless it might provide the illusion. But this is certainly not a game “camera” tool.

  2. Can you have it not “snap back”. Yes, see: https://docs.coronalabs.com/api/library/widget/newScrollView.html#isbounceenabled-optional

  3. At the end of the day, a scrollView’s underlying structure is a display.newGroup(). There are rules on having some physics bodies in multiple groups that would be impacted.

Rob

Thanks for the replies guys, appreciate the help. 

@JWiow: I was thinking about using a looping scroller to do this but I am not sure it would of worked the way Intended since the player can move freely left and right. I was worried that the animation might get caught up after a few quick rapid moves. 

@Rob Miracle: That trick with the viewport might be worth a try. When you mention ‘viewport’ do you mean the scrollView length? Would it be possible to show me roughly how you would check against that value and perform the jump? 

Cheers