How do I make a button got to different layouts depending on

0 favourites
  • 3 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi guys,

    I am fairly new to C2 and have a problem that I can't seem to find the answer for.

    I have a project that has several layouts and navigation buttons that need to have a different layout destination depending on certain selections.

    I already know how to have just 1 button with varying stated (animation frames) set up on one layout and be active on all other layers with the same name throughout my project and I know how to set up a variable that can be used to set the layout that that button should navigate the user to depending on there choice/s. What I need help with is telling that button where to navigate to depending on what user choice has been made.

    For example if a player selects the blue pill they go to layout 2 and if they select the red pill they go to layout 3 and so on. This needs to be achieved using just one button and variable. The same button on every layout needs to have a different layout destination depending on the users choice. I don't want to be hiding/activating and un-hiding/de-activating several different buttons on one layout when I know one button could do the same job.

    There is probably a simple solution to what I'm trying to achieve although I cant figure it out myself after several weeks of coming back to it time after time.

    Any help with this would be greatly appreciated.

    Many thanks, Dan

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From the "How do I FAQ"

    [quote:1q65lczx]

    Navigation through layouts/levels (single event sheet) - LINK

    Navigation through layout (with demo capx) - LINK

    This is a basic idea.

    In your case, you want the action of taking the pill to set a specific value for the "end variable" that determines what layout you are going to.

    So in pseudo code:

    Global Var EndLevel as number

    On collision with Blue Pill => Set EndLevel value to 1 ; Destroy Red Pill and Blue Pill

    On collision with Red Pill => Set EndLevel value to 2 ; Destroy Blue Pill and Red Pill

    On end of level => Go to "Layout " & EndLevel

    Considering your layouts are named "Layout 1"; "Layout 2", and so on.

    This way, when picking a specific pill, you set a value to a variable that will be "directing" toward a specific layout when the actions of end level happen.

    This is pseudo code (the actual logic supposed to happen), as the actual implementation depends a lot on what you actually already did in your project.

    If you have issues with concrete implementation, do post your existing capx it will be easier to let your know directly what implementation is appropriate in regards to how you did things so far.

  • Many thanks Kyatric I will give this a go and see what I can achieve however, my game is not a game it's going to be an app and I will include a capx when I get to your tutorials on creating capx files as soon as I can. There are no red or blue pills in my app btw lol, this was just an example (a bad one).

    Great software BTW

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