How do I do this layout transition?

0 favourites
  • 15 posts
From the Asset Store
Complete the collection by purchasing Game and Film Logo Transitions Pt.2: Musical Loops
  • 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!

  • Provide a basic capx ?

  • 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!

  • Shameless bump. Still cant find a proper way. Thanks

  • Can you rephrase what you need?

  • 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

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

    99Instances2Go that's exactly what I was looking for!! Thanks pal!!

  • 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.

  • 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.

  • 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

  • First this. The key controls dont work for me. I suppose the functions are not in place yet. I have set the platform on default controls to be able to move the player. I had to change the gamepad triggers to a key trigger for the same reason.

    You have doorObj.nextLayout set to "test_01" in the properties plane. Dont use the "'s In the properties plane to assign a string to an instance variable. Just test_01 without the ""-tingys.

    That event can much easyer. This does allready what you want. And it is not running every tick the player is overlapping a door. Only when the key is pressed (had to change the gamepad trigger, dont have one).

    https://www.dropbox.com/s/q0g7aopkpvs3c ... loos-1.jpg

    Then there is something that i dont understand. The two player objects are set Global = No, in theire properties. Normaly, if you change layout, they should get destroyed. So you must create them somewhere, but i cant find the creations in your, dang well commented and organised, project.

    Normaly, one would set those two objects to global. Global means, once added to a layout, they stay forever. Even if you change layouts. Till you destroy them, ofcourse. Theire instance variables will also survive a layout change. At this moment you move the object to global variables for a new x&y. Hence: Global. If you make those objects global, you could let the door write to instance variables of the player-helper, wich is more elegant, and flexible.

    It is common use to start the game in a 'loader layout'. This layout contains the Global objects, it loads everything needed from Local storage, sounds ... etc. And then moves to the actual layouts, taking the Global Objects with it.

    If i do so in the project, i get two players on layout change. They are not in layout of test 1 & 2, so they must be created somewhere. But i am to dumb to find the create actions, or i misunderstand something.

    Something totaly differend. I dont like the lerp on the camera. Lerp expects static input. If you use non static inputs, the lerp will never reach the destination. Resulting in a restless camera and flickering, because you have pixelrounding set.

    Hope i helped. The main problem was the "" in assigning text to instance variables in the properties plane.

  • 99Instances2Go Yes, thanks! and much more in-depth than what I was expecting.

    Sorry about not having keyboard input, had it at the beginning but went through several transitions so opted for now to keep it only for gamepad.

    I'm not using a loader layout because so far is only a test_bed for different mechanics. In the future the test layout will be my loader layout if that's a good practice, not sure I'm doing it in the right order lol.

    I didn't realize PlayerDetect object had to be to global, but now that you point it out, it would make sense. They are created in the Player Ini section and also in main where I set the initial position for PlayerDetect. Then Player containing animations is set to the controller position.

    You are right, lerp is horrible, and I didn't even know why lol. Now I'll check a better solution.

    Like I said, really good explanation, so now it seems very clear to me. Thanks for your time!

    And if you failed to see where I initialize the Player maybe is because I didn't follow a correct way of doing it. It might be kind of messy, even if I try to keep it organized.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Cap the lerp ?

    condition: System > compare 2 values .. distance(scrollx,scrolly,objplayerhelper.x,objplayerhelper.y) .. > .. 4

    action: do the lerp

    Dont renember exact name of that objplayerhelper.

    That way, the lerp will not move the camera arround in this shaded circomstances where it cant reach the distination.

  • Thanks, that looks much better!

    Now, I created a loader layout, and made me realize my Player layer was global so that's the reason why it was working.

    Now, after I set it up properly, I arrived into a new problem. start x & y pos aren't being updated as fast as Player goes into new layout.

    In purpose I made floor smaller so Player Controller could fall outside of layout. So Player x and y pos are updated to the door only after this happens. This wasnt happening before making Player Controller global so I suspect there's something I'm not updating in the right place before it changes layouts.

  • Nevermind, I found it. I changed a bit some events and forgot to initialize the player starting pos in a new layer using the variables of startXpos & startYpos.

    Thanks again for the help!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)