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

Get help using Construct 2

Post » Tue Oct 13, 2015 4:07 pm

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.
B
6
Posts: 40
Reputation: 336

Post » Tue Oct 13, 2015 4:23 pm

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.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Oct 13, 2015 4:55 pm

jojoe wrote: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?
B
6
Posts: 40
Reputation: 336

Post » Tue Oct 13, 2015 6:40 pm

Message: Knovolt is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
jojoe wrote: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?
B
6
Posts: 40
Reputation: 336

Post » Tue Oct 13, 2015 7:03 pm

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.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Oct 13, 2015 8:44 pm

jojoe wrote: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.
B
6
Posts: 40
Reputation: 336

Post » Tue Oct 13, 2015 9:05 pm

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.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Sun Oct 18, 2015 9:45 pm

Message: Knovolt is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
jojoe wrote: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?
B
6
Posts: 40
Reputation: 336

Post » Mon Oct 19, 2015 12:22 am

jojoe wrote: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.
B
6
Posts: 40
Reputation: 336


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, RobertMKD, Syazanie Amirin and 10 guests