How do I go to the next layout by keyboard button?

Get help using Construct 2

Post » Thu Apr 05, 2012 6:31 am

Hello,
I have a series of layouts. I am trying to make it so that pressing left or right keyboard goes to the next or previous layout.
Here is my project: http://dl.dropbox.com/u/65183389/map%20project001/index.html
as you can see, the keyboard buttons only work for the first layout.
B
3
Posts: 3
Reputation: 281

Post » Thu Apr 05, 2012 7:24 am

This is my suggestion, don't know if there is anyone else with a better idea but.

In that new layout, that you switch to when you press the right key, just make the same actions in that event sheet again, and add another that when you press left, goes to the previous layout.

I would make an example but I'm at work so I can't right now. But basicly:

Layout 1
Event Sheet 1
Keyboard -> "On right key pressed" -> System - >Go to "Layout 2"

Layout 2
Event Sheet 2
Keyboard -> "On right key pressed" -> System -> Go to "Layout 3"
Keyboard -> "On left key pressed" -> System -> Go to "Layout 1"

Layout 3
Event Sheet 3
Keyboard -> "On right key pressed" -> System -> Go to "Layout 4"
Keyboard -> "On left key pressed" -> System ->Go to "Layout 2"

And so on..

Hope I could help.
B
13
S
5
G
2
Posts: 64
Reputation: 3,012

Post » Thu Apr 05, 2012 7:42 am

hmm...not the most elegant solution, but it will do for my purpose. Thanks!
B
3
Posts: 3
Reputation: 281

Post » Thu Apr 05, 2012 11:26 am

@gault8121 No problem man :)
B
13
S
5
G
2
Posts: 64
Reputation: 3,012

Post » Thu Apr 05, 2012 12:12 pm

You need not duplicate any events if you use 'good names' for the layouts - eg: layout1, layout2, layout3 (=same "textname" + number)

How do I- Frequently asked questions - Layout
--> Suggestion: Layout behaviour

I don't see a working example with source, so here are two :
short version: include a navigation-event-sheet in every to the layouts linked eventsheets and use a global variable for the number of the 'active'(current) layout

with Buttons - demo - capx (r85)
with Arrowkeys - demo - capx (r85) Joe72012-04-05 12:58:46
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Sat Apr 13, 2013 12:49 pm

[QUOTE=Joe7] You need not duplicate any events if you use 'good names' for the layouts - eg: layout1, layout2, layout3 (=same "textname" + number)

How do I- Frequently asked questions - Layout
--> Suggestion: Layout behaviour

I don't see a working example with source, so here are two :
short version: include a navigation-event-sheet in every to the layouts linked eventsheets and use a global variable for the number of the 'active'(current) layout

with Buttons - demo - capx (r85)
with Arrowkeys - demo - capx (r85) [/QUOTE]

Hi Joe...I am trying with my Multiple layouts..But its not happening......:(
B
14
S
2
G
4
Posts: 43
Reputation: 3,170

Post » Sat Apr 13, 2013 6:17 pm

Problem Solved..........:)
B
14
S
2
G
4
Posts: 43
Reputation: 3,170

Post » Thu Oct 31, 2013 11:35 am

can I make "go to random Layout" with your method?
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Thu Oct 31, 2013 11:41 am

@Dzaky Alkaff

that would be pretty simple.

Just set activelayoutnumber to choose(1,2,3,4) or floor(random(1,5)

If you have more layouts than 5 just change the numbers.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
53
S
16
G
8
Posts: 6,157
Reputation: 19,744

Post » Thu Oct 31, 2013 12:27 pm

where do I randomize the value?,
on "On Start of Layout" event??
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Next

Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Kagubro, Solomon and 28 guests