How do I stop dragging when at top or bottom of list

0 favourites
  • 9 posts
From the Asset Store
Template for scrollable list, fully documented in comment and video
  • So I have the user scroll/drag up or down to navigate a list of missions. How do I stop the user to continue dragging the list of missions down when he's already at the bottom of the list. Vice versa: How do I stop them scrolling up when they're at the top of the list.

    If they continue scrolling the mission list will just keep moving further and further away from my layout, leaving behind only the background in view.

  • Load your list into an array, Then you can copy the last value to the front , and pop the cell that the last value was in for your scroll. It will only loop through the values in the array. You wont need to scroll the screen at all this way, the list will scroll .

    Here is a load thing i was working on:

    https://mega.nz/#!kAxBQRTJ!ZqM9eHA0R-q4 ... lPRiPPXQFA

    look at where I click the up and down button to see how to scroll up and down.

  • Load your list into an array, Then you can copy the last value to the front , and pop the cell that the last value was in for your scroll. It will only loop through the values in the array. You wont need to scroll the screen at all this way, the list will scroll .

    Here is a load thing i was working on:look at where I click the up and down button to see how to scroll up and down.

    So I can load my missions, including their description and bunch of other miscellaneous text (like requirements + rewards) all into an array?! Please confirm.

    Also, how do I stop the list from looping?

  • Load your list into an array, Then you can copy the last value to the front , and pop the cell that the last value was in for your scroll. It will only loop through the values in the array. You wont need to scroll the screen at all this way, the list will scroll .

    Here is a load thing i was working on:look at where I click the up and down button to see how to scroll up and down.

    If I'm going to go with arrays (your idea), I'm going to have to scrap mine. As I have currently got "mission panels" which contains the information of said mission along with its context, requirements, rewards etc. And it piles on and on creating a rather huge list that expands past my view able layout/window. That sounds inefficient, i think?

    But, I really have no idea how to incorporate having a list of "missions" stored into an array. Pointers?

  • Store the mission names along the X axis, and everything about the mission in the Y axis.

    So the entry will look like

    X=0,Y=0 Level1

    X=0,Y=1 Description of level one

    X=0,Y=2 Level 1's .JSON load URL

    X=0,Y=3 Last date played

    X=0,Y=4 Highest Score

    X=0,Y=5 Whatever...........

    When you add a new level insert on the X axis.

    You are basically building a small database in the array.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Store the mission names along the X axis, and everything about the mission in the Y axis.

    So the entry will look like

    X=0,Y=0 Level1

    X=0,Y=1 Description of level one

    X=0,Y=2 Level 1's .JSON load URL

    X=0,Y=3 Last date played

    X=0,Y=4 Highest Score

    X=0,Y=5 Whatever...........

    When you add a new level insert on the X axis.

    You are basically building a small database in the array.

    I've read the array for beginners guide. And think I can candle arrays to a small extent. But there are so many things that confuse me in your events. Care to elaborate for some of them? (I know you have labelled them with is helpful, but I guess I need more help).

    For example, what are the functions for? And why do I need to "call" stuff.

    And why do I need to destroy the sprites at the end, and then recreate it?

    Really want to understand/learn from this rather than copy/pasting your work.

  • The destroy before you create makes so you can refresh the screen, and re-daw the list, without re-drawing it on top of the old list. So every time before you draw anything, you should first delete the old version.( re-draw = "refresh")

    I use Functions quite a bit. They are for re-drawing the list, and re-drawing some of the menu elements.

    I think Ashley describes functions the best:

    https://www.scirra.com/manual/149/function

    So basically you make a change to the array, you want to refresh the screen ,so the user can see it in the list.

  • The destroy before you create makes so you can refresh the screen, and re-daw the list, without re-drawing it on top of the old list. So every time before you draw anything, you should first delete the old version.( re-draw = "refresh")

    I use Functions quite a bit. They are for re-drawing the list, and re-drawing some of the menu elements.

    I think Ashley describes functions the best:So basically you make a change to the array, you want to refresh the screen ,so the user can see it in the list.

    I'm stuck at this for like a week lol.

    Anyways. Can you tell me how did you so that when you add a new array value, there will be a sprite (background) behind it?

  • The destroy before you create makes so you can refresh the screen, and re-daw the list, without re-drawing it on top of the old list. So every time before you draw anything, you should first delete the old version.( re-draw = "refresh")

    I use Functions quite a bit. They are for re-drawing the list, and re-drawing some of the menu elements.

    I think Ashley describes functions the best:So basically you make a change to the array, you want to refresh the screen ,so the user can see it in the list.

    I've got an image-point on the top of my list, and an image-point on the top of the border. I did a Pick Overlap, and when my list overlaps the border's imagepointX and imagepointY, it will stop scrolling.

    But how do I only stop the user scrolling up or down, when a condition is met? For example they can't scroll in the negative (-) Y direction?

    In other words, how do I stop the user scrolling further up/down when "list" Y position = "border" Y position.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)