netdzynr's Recent Forum Activity

  • You can add all such objects to a family. Then use "Family on created" event.

    Thanks for this suggestion. Was able to get the layout to work after putting all the various "box" objects into a single family.

    This brings up another question about families or containers (or maybe neither of these)...

    If I want to reposition a bunch of objects as a group, for example, to create a transition where all objects (cards, pieces, dice, etc) on a game board animate off the board in a defined direction, is there some way to define/reference this grouping, using either families or containers (or something else)?

    I'd like to apply animation to the objects as a group, rather than having to pick through the various object types and instances.

  • OK, after creating the object by name, how would I set a property, say opacity, of that object using the same dynamic reference? It doesn't seem like I can pick the last object created without selecting its type first...

  • R0J0hound

    Thanks, silly me, of course you're right.

  • Is there some way to refer to an object (in this case a sprite) using a name that is generated dynamically?

    For example, with three sprites named "box1", "box2", "box3"

    Is there a way to do something like:

    Global number N? = 2

    System: On start of layout

    System: Create object ("box" & N) on layer 0 at (100, 100)

    In the editor, the Create Object action seems to be designed for an actual object reference, but could a function or array possibly be used here?

  • Yes! Version 6 of your example is perfect. "Overlapping (Mouse.X, Mouse.Y)" is the equivalent of a point within() function.

    This is all I meant by no function needed -- just one action:

    https://www.dropbox.com/s/z19l9ypm2xx2d ... 2.c3p?dl=1

    Thank you so much! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • tarek2

    Please don't apologize! I'm grateful to receive your help, and your projects have been useful for me to better understand Construct.

    The example you posted is the right combination of triggers, but I was hoping to combine them so that only one function call was required, instead of two. Logic like this:

    IF

    zone is touched

    OR

    button is clicked with additional conditions

    THEN

    call function

    If this is possible, the function isn't even necessary, since there could be single (flash) action.

  • tarek2

    BTW, I wasn't able to find a way to combine the sprite touch and the button click into a single "or" event. Is this not possible because they are two different types of triggers? Like:

    zone is touched

    OR

    button is clicked

  • Try Construct 3

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

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

    Thanks once again. By looking at your example files, I was able to get a solution that seems to work.

    The goal was to make a sprite respond to a touch/click action, regardless of whether a button appears on top of the sprite. But interaction should only occur within the rect of the sprite. I used the Bbox properties of the sprite to establish the active (clickable) region for any button. You'll see that when a click occurs within the rect occupied by BOTH the sprite and the button, the trigger takes places. No trigger occurs when clicking outside the rect of the sprite. So this effectively acts a way to make the sprite react even when a button is overlaid on top of it.

    Construct 3 project

    https://www.dropbox.com/s/wxpwp0ms6ozmk ... d.c3p?dl=1

    Thanks again for your helpful projects.

  • tarek2

    I think that will work, thanks. The method is "cheating" a bit because if a portion of a button falls outside of the rectangular region of the sprite, the sprite is still triggered, but this is probably good enough for now. Perfect that multiple instances of the button will trigger the sprite as this will be my situation: multiple buttons stacked on top of each other, stacked on top of a sprite.

  • Thanks for this, but unfortunately when overlaying a button on top of the objects, the button grabs the touch event and your player object doesn't respond. Even if the button is disabled in the editor, the touch event still seems to be blocked.

    This is why I'm wondering if there's some other way to simply test whether the touch/mouse falls within the rectangle occupied by the sprite (or the region on the screen).

  • I've read that native controls (buttons, scrollbars, etc) automatically get layered over sprites, and apparently there's no way to override this. I'm trying to determine if a touch takes place within a region defined by a sprite, even if the sprite is not the frontmost object (because a button is frontmost and overlapping the sprite).

    In other languages I've used a within() function to tell whether a click/touch takes place within the rect of an object, or a defined region on the screen -- basically, if an x,y point falls within a rectangle. How is this done in Construct? Do I have to compare the X and Y values of the touch separately?

  • You're right, I was trying different methods of evaluating a string rgb(0,0,0).

    Your option will work, thank you.

netdzynr's avatar

netdzynr

Member since 17 Dec, 2017

None one is following netdzynr yet!

Trophy Case

  • 6-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

9/44
How to earn trophies