Multiple Layer and Activate/Deactivate Issue.

0 favourites
  • 10 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hello everyone, I have a question that I hope can be solved. I have been researching and trying different things for about 3 weeks now, so I am at the point of needing someone else's eyes and brains.

    My capx:https://www.dropbox.com/s/rbzxoltjhtj3jhp/Help_Example.c3p?dl=0 (this is a dummy capx

    Problem: When I first started making the layers for my levels and level buttons, I quickly realized that I need to put certain things into groups and activate/deactivate as needed. I did this by creating an event sheet called Active/Inactive Groups. In this sheet I:

    1.Created groups for my levelsprite buttons by variable: "0-5", "6-11", and "12-17". (This determines which level is chosen).

    2. created groups for my NextLastButton (switches between layers):"CDtoEF", "EFtoCD", and "GHtoIJ". (In these groups, if NextLastButton is touched > set layer visible; set other layers invisible)

    3.On StartofLayout:set layer "abcd" to visible

    4.When layer is visible: set specific groups active/inactive.

    Disabling and enabling my NextLastButtons works fine. Even when directly stacked on each other, they do what they are supposed to do without issue.

    Disabling and enabling also works on my levelsprites, it ensures that when I choose one button, it doesn't choose the button from a different layer. However, the only time these buttons will actually work, as in take me to the level layout, is if they are on the bottom-most layer. It is as if all the other layers, even though invisible + disabled/enabled groups, are blocking the levelsprite on the current layer.

    Example: Layer "abcd" is visible> set group "0-5" activated AND set group "CDtoEF" activated. All the others should be deactivated.

    I see layer "abcd" (as I should), I see the levelsprite buttons meant for that layer (again, as I should), and I see the NextLastButton for that layer ("CDtoEF"--which works to go to the next layer), but the levelsprite buttons are not reacting to my touch.

    I have looked online at the various forums with this information, but unfortunately, there is not much I can find on this specific issue. I have seen that I can try "for" with my levelsprite buttons, but because they are split into groups by variable, I am not sure how I would accomplish that. If anyone could help, I would GREATLY appreciate it.

    Sorry to go into detail so deep, I just want to make sure my problem can be understood. If you test the capx though, you will see what I am talking about. Thanks in advance!

  • All I'm seeing is a level with a padlock on it, I'm guessing that's why you can't touch it because it's locked

  • Hmm, that is strange. I am able to click into levels, beat them, and unlock the next. When I can get to my computer I will make sure it is the right capx.

    EDIT:

    This is the right capx. When I downloaded it and I preview the project (which has to be done from the main menu layout or it won't work), it takes me to layer "abcd" which is the only one that allows me to click because it is the lowest layout. Maybe try clicking the reset button? I know that has worked a couple of times for me, but that's usually when I accidentally preview from the level layout. I cannot thank you enough for your time, and patience!

  • It's because you're still touching the sprite that is level=0 even though it's invisible, the sprite that is level=6 is behind it

  • Yea, that's why I made the groups activate and deactivate... before I did this, it would click into any of the levels, no matter the layer. But once I created the groups, it worked, or worked-ish.

    I guess I am confused. Why does it work like it should with the NextLastButton, but not with the actual level buttons? I mean, activating/deactivating works perfectly with the nextlastbutton (and they are stacked on one another like the levelsprite buttons), but it doesn't work as intended with the levelsprite buttons.

    I am so lost. I have this, and one other thing to do, and I can finally be done with this project I feel like I have been working on for like, half of my life. Do you have any suggestions on what I should change/fix to make it work?

  • Ah I see the problem now, your system conditions on the level sprite object in the groups don't pick the proper instance, you need to use the object compare instance variable condition greater than equal 6, less than equal 11 and compare frame on the object too, don't use system conditions.

  • Actually that still picks the top instance which is the wrong instance. I dunno, it was a silly way to do this kind of UI lol.

  • It is the only way I could get this to work. I have been trying to figure out the correct way to level select since December. That worked fine, until I needed 144 level buttons. I have read everything available, I have watched every video, I have gone through plenty of tears, plenty of frustrations, and still I cannot figure it out. I don't know what to do. *sigh*

  • You've gone with a method of making objects invisible and combined with touch when you can still touch the invisible objects that are above. The better way to do this would've been to have 6 sprites with instance variable 0 - 5, then when you press next add 6 to each objects instance variable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, adding 6 did not work, but I went back through, again, and found that I just needed an "is on layer" event for the levelsprites. Thanks for your help anyway though, I appreciate your time!

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