[Issue]Targeting specific instances from 2 families

0 favourites
  • 7 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Alright, where do I begin.

    Here's the current version of my generator.

    • You'll notice the cursor changes to the hand icon whenever it's over interactive elements like buttons. This is made possible by the Interactive family that has a "IsClickable" variable and a single function tied to them.
    • On the last menu (the one with the cherry) you can drag and drop decoration items over the cupcake. When the mouse hovers them the cursor changes to indicate they can be moved.
    • When the Decor menu is active, the sprites turn visible and drag n drop is enabled. This is made possible with a global variable.

    When you change the submenu, any sprites left on the white area of the menu turn back invisible and disabled while the ones outside it remain visible and enabled.

    • The decoration sprites share both the Interactive and the SM_Decor families. Ideally each sprite that is visible and enabled should have the cursor change whenever the mouse hovers over them. The Interactive Family has a boolean variable "IsDragItem" that's set as true for DragnDrop sprites.

    However, this is happening:

    • Select the Decor Menu
    • Drag a sprite outside the white menu area, notice how the cursor has changed.
    • Select another menu
    • Hover mouse over the sprite left out of the menu area. Cursor doesn't change. You can dragndrop the sprite.
    • Go back to the Decor Menu. Hover over sprite left outside. Cursor changes.

    This is how I currently have this set up.

    In theory this should be working. But instead I have the event triggering on all sprites instead of specific ones that follow the requirements. It's puzzling. And if you drag all the sprites out of the menu area and change the menu, the cursor does change!

    Could someone please help me? Is there something I'm missing?

    Thank you for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey,

    it's a little hard for me to see exactly what's going on in this event sheet but I think your problem stems from the decor menu being used as a trigger to set your decorative sprites as visible and movable. When you re-open the menu, the cursor changes in the cupcake viewer to the left again. Perhaps you were attempting to get around these triggers by having the sprites in 2 families but I'm not sure that will work. If for some reason re-working the decor trigger proves untenable, you can always have identical sprites spawned from your decorative ones when drag and drop is released, having the originals destroyed.

  • Ok, just realized this current version (0.1.1.0) is doing the opposite:

    • Select the Decor Menu
    • Drag a sprite outside the white menu area, notice how the cursor has changed.
    • Select another menu
    • Hover mouse over the sprite left out of the menu area. Cursor changes. You can dragndrop the sprite.
    • Hover over the menu where the others sprites used to be. Cursor changes over them even though they are invisible and disabled.

    The screenshots above apply to version 0.1.1.0. Everything I do results in either the issue description in the original post or this one. I apologize for the mixup, unsure if this is any help at all.

  • For the most recent issue, you can solve it by using a system like this:

    https://www.dropbox.com/s/8d2co8ain01ol ... .capx?dl=0

    For the previous issue, it's hard to say. Are you still experiencing that? I have theories but if you have it fixed I'll save it lol

  • I applied your logic to my events and it went back to the first issue I explained, lol.

    Here's the .capx if you want to take a look yourself. Mind the mess. The events related to the mouse cursor change can be found in the Global Events sheet. The ones related with the cupcake menu are in the Baking Tray sheet.

    This issue has been bugging me for days now, I just want to go back at drawing more assets for the cupcakes.

  • hmm, well honestly your capx is a little too complex for me to get through it and fix whatever is going on with my current time constraints. My general feeling is that you're using overlaps with whole families without passing a UID through functions to select which particular items you're setting to draggable and active so the whole family is being impacted.

  • I found a solution. Not very elegant but it works.

    I found out via the debugger the app wasn't always assigning the updated variables between the two families:

    Interactive is DragItem (boolean) ->

    Set Interactive.InteractiveIsIt to SM_Decor.Interactive

    Without Interactive.InteractiveIsIt being updated, there were no changed to the "IsClickable" boolean.

    I set up a function "CheckActiveDecor" that's triggered whenever the menu changes. Menu changes, function runs a check on all decor items and sets the variables accordingly. It's working so far.

    In short: variables not updating properly? Use functions.

    Thank you for your time!

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