How do I do this layout transition?

Get help using Construct 2

Post » Thu Jun 16, 2016 12:36 am

Hi,
So I managed to sort of resolve my problem with doors.
Now, I would like to transition between layout using a database. is it possible?

I have 5 doors in the same level leading to 5 different layouts, and since I can come back to the first layout, I would like to find the best way to do it.
I couldnt figure out how to do it using variables.

Thanks in advance!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Thu Jun 16, 2016 2:18 pm

Provide a basic capx ?
B
33
S
18
G
27
Posts: 2,434
Reputation: 20,332

Post » Thu Jun 16, 2016 11:49 pm

To explain myself better (hopefully lol)

I need to retrieve info about layout in which an object is placed.
All I can see for now is go to layout by name or go to layout, but if it would be possible to lead me into another direction it would be appreciate.

The reason, in my project there will be a good amount of doors, game is a 2D side scroller.

Thanks!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Jun 17, 2016 9:37 pm

Shameless bump. Still cant find a proper way. Thanks
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Jun 17, 2016 9:54 pm

Can you rephrase what you need?
Music & Sound.
B
35
S
22
G
9
Posts: 47
Reputation: 7,822

Post » Fri Jun 17, 2016 10:01 pm

Ok, so you want to go to a layout containing a certain object?
Make a global array. Pre-store all the info in it. Evaluate.
Update the array when in a certain level.

Layout name can be an expression. Expressions can contain variables.
https://www.scirra.com/manual/78/expressions

And it is not 'only like no more then go to layout by name'. That is just the action. You dont need no more then that one action to change to another layout.

The thing is ofcourse, the condtions that lead or not lead to a change of layout. There are miljoens of combinations thinkable.

By example.
If variable = 2
got to "layout 1"
Else go to "layout 3"

on player collsion with leftsideofthedoor
got to "layout "&str(door.desti)
on player collsion with rightsideofthedoor
got to "layout "&str(door.prev)

The question is so general. Answher can only be general.
https://www.scirra.com/manual/83/variables
https://www.scirra.com/manual/73/instance-variables
https://www.scirra.com/manual/108/array
B
33
S
18
G
27
Posts: 2,434
Reputation: 20,332

Post » Sat Jun 18, 2016 12:05 am

@nvbenegra, sorry for the incomprehension, english is my third language. Thanks for trying!

@99Instances2Go that's exactly what I was looking for!! Thanks pal!!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Jun 18, 2016 3:49 pm

@99Instances2Go thanks, actually I had no idea we could use expressions in Layout by name which was the info I was missing.
So far so good, I retrieve my info from csv to array.

Sorry for the question too vague, wrote from the studio and since we are in pre-prod for the time being I have little time and little brain to actually even understand myself. lol

A last question, do I need to use arrays if I'm already retrieving the info from a csv table? Thanks in advance.
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Jun 18, 2016 6:09 pm

An array is organised variables. So is a csv table. And your English is as good as mine.

I never used a csv table myself in Construct. But just in case you need them ...
Here are exellent plugins to handle a csv in construct.

plugin-csv-csv2array-csv2dictionary_t64326
B
33
S
18
G
27
Posts: 2,434
Reputation: 20,332

Post » Sat Jun 18, 2016 8:03 pm

@99Instances2Go, yes, its a great plugin, I'm using it thanks!

I fail to find examples in how to do it properly. By browsing the forums I saw how to go to a random Layout but it wasn't very helpful in my case.
I know I could simply hardcode the info on a sheet so I would simply compare the doorID with the var and then set the Player pos to the new Layout.
But I would like to do it in another way if possible since in the long run it will probably become difficult to manage so much info this way.

I'm leaving here a capx file, I'm sorry in advance, if you guys wanna help me you'll have to install the rex_fsm behaviour since is already rooted in my project.
Player can be controlled with controller exclusively, for that too I'm sorry.

I added a bookmark so its easier to find the lines for which I need help. Thanks in advance!


https://drive.google.com/open?id=0B27TG57JCwl_dW1vdElmNVFyZm8
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], marc254 and 5 guests