How do I scroll through weapons?

Get help using Construct 2

Post » Sat Nov 08, 2014 6:50 pm

I have an array that has the weapons in it and every time you scroll down it chooses the weapon below the current one and scrolling up chooses the one above it, but when I get to the last entry in the list instead of scrolling down going back up to the top it sets the weapon value to zero and stops. If I scroll up at the topmost weapon it sets the value to zero, but scrolling again will set it back to the bottom most gun. How do I effectively set up this system?
B
5
S
1
Posts: 59
Reputation: 497

Post » Sat Nov 08, 2014 7:36 pm

If you don't have fixed positions for the weapons like 0=fist 1=pistol... you could set the array x to 0 and when you get new weapon you can use push back on the array.
When your weapon selection is greater or equal the array width (note that array width will count also the first 0) set selection to 0 and when your selection is less than 0 set selection to array width-1.
B
34
S
9
G
3
Posts: 517
Reputation: 5,246

Post » Sat Nov 22, 2014 7:37 am

See the guns are always static though, the first gun will always be the pistol the second will always be an ice gun, etc, how do I make this work?
B
5
S
1
Posts: 59
Reputation: 497

Post » Sat Nov 22, 2014 10:40 am

One option I think should works is to name the weapons as "0_Pistol", "1_Ice gun" and every time you pick a new weapon you could push it back and sort the array.

Another option is to have fixed positions in the array and run loop to next none 0 slot.
B
34
S
9
G
3
Posts: 517
Reputation: 5,246

Post » Sun Nov 23, 2014 1:51 am

I have the second setup you described at the moment, but I must have done it wrong because it doesn't work properly. Can you give a quick screencap of the loop setup?
B
5
S
1
Posts: 59
Reputation: 497


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests