How do I make a scrolling menu

Get help using Construct 2

Post » Thu May 04, 2017 2:07 pm

hi guys, how can I make a scrolling menu with gamepad.
It should scroll vertically and snapp to the next menu text underneed or above ...

example:

a
b
C
d
e
f
g

scrolling from C down..the movement should be snapping...not smooth...any sample that u can show me ?

thanks a lot
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Fri May 05, 2017 5:40 pm

Global Var MenuSelect
Global Var MenuSelectPx
Global Var GoSelect

Create Object MenuSelect as Bar Color (Opacity 40 (Ex))

Start Layout MenuSelect = 1 (A)
MenuSelectPx = Inicial Pos Y Menu A (Ex: 400)

A=1 <- Selected MenuSelect Bar Color - Pos Y of A(Ex: 400)
B=2
C=3
D=4
E=5
F=6

Distance between menu texts (ex: 40 px)


Gamepad:
On Game Pad DPad Down MenuSelect = Min(6,MenuSelect + 1)
On Game Pad DPad Up MenuSelect = Max(1,MenuSelect - 1)

Mouse:
On mouse over A - MenuSelect = 1
On mouse over b - MenuSelect = 2
Etc...


Every Tick: MenuSelect "<-(bar color)" lerp(Self.y,MenuSelectPx+(MenuSelect*40),10*dt)

Or

Event: MenuSelect <> 0 and trigger once
MenuSelect (Bar Color) Destroy
Create Object MenuSelect (Bar Color) Pos X (ex: 1100) Pos Y MenuSelectPx+(MenuSelect*40)


On click:

GamePad Button A - GoSelect = 1
On Mouse click - GoSelect = 1

Event: System Global GoSelect = 1
SubEvent - MenuSelect = 1 Goto Layout x
SubEvent - MenuSelect = 2 Goto Layout y
SubEvent - MenuSelect = 3 Goto Layout z
SubEvent - etc...

I think this is it.
Creating games for fun!
B
10
S
5
G
2
Posts: 10
Reputation: 1,870


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, grigrizljac, korbaach and 16 guests