JMKit's Forum Posts

  • Hi, I've searched the forum for an answer to this, and I've seen the idea that you can disable the layers' actions if you put them in a group and enable / disable based on if the layer is visible and this works for a menu with sprites as buttons etc..

    however in my example I'm using this code to drag out newly created sprites and put them on a new layer

    My goal is to be able to hide the spites that you drag (to drag out the newly created sprite) and not be able to click them when the layer is invisible.

    Basically what would be perfect would be a way to disable drag and drop for all the sprites on (in this example) the 'BeachDraggables' layer - when that layer is hidden, and still be able to drag the sprites on the 'Dragged' layer

    I've tried adding the sprites to a family and disabling the family drag and drop behaviour but then they all stop dragging (including the ones on the layer 'Dragged')

    hopefully this makes sense and any help would be appreciated

  • Ok so I thought I'd post my findings in case anyone looks through this thread in the future,

    This is what I came up with (based of codahs suggestion!) just tweaked for my purposes of bringing out a new instance on top and moving to a new layer all in one click / drag out

    Thanks to everyone for your suggestions

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:22876nhg]Oh, sorry. Your problem in this is already solved to make the next ball draggable. Way to bring it to the front so it has the effect of popping out of the original sprite? My poor suggestion is using the action "(OBJECT) set to top of layer".

    That's ok I appreciate anyone weighing in on this.

    [quote:22876nhg]Is there a reason that won't work for you?

    Your example there works perfectly, strangely however when I recreate it, it drags the first sprite underneath but then all the rest on top, I have added more 'draggable' sprites into the same family and it seems to work the same for all 3 (so far) so it's like one last little peace of the puzzle and it'll be perfect

    (only changes I made was naming the family 'Draggables' instead of 'other sprite' and making the family instance variable 'Dragid' instead of 'id')

    I'll keep tweaking it, but if anyone sees any reason why the first is going under and the rest over, let me know

  • Hey, codah - not late at all thanks for your input!

    So I thought that example was just what I was looking for, however if you put any kind of pattern on that green square and drag it out, you'll see it's still dragging from underneath, is there no way to bring it to the front so it has the effect of popping out of the original sprite, seems everything i try just makes it come from underneath O_o

  • Can anyone tell me where to find 'IsDraggingUID', I've been looking and can't find any commands that look like that.

    I'd like to just say, when the new ball is created, start dragging it. Sorry if that's been explained above but I just can't figure out how to actually put that in anywhere.. Thanks for any further help.

  • Ok so i've read this:

    [quote:2wz31p0s]You need a global variable to store the newly created BeachBall UID.

    An event will snap the BeachBall with this UID to your Touch coordination.

    On created Object "BeachBall" : Set Global Variable "BeachBallUID" to BeachBall.UID

    On Touching the screen

    ------Pick Object by UID = Globalvariable BeachBallUID : Set BeachBall position to Touch.X and Touch.Y

    and:

    [quote:2wz31p0s]Should be doable with just one IsDraggingUID..

    And I am a newb to the finer points of Construct2 - (I'm coming from a game made in flash / AS3 and learning the new ways around here to convert it as my first main project) I'm defiantly more of a visual designer which is why I'm enjoying working in this platform and being able to add behaviours with a click.

    So this sounds like more slightly finer detail work than that, can someone show an example of how this would look in practice, it will help me get a handle of it and hopefully let me understand more in future. Thanks

  • Ah, so it's creating one underneath the new one at the same time as dragging it away.. That sounds about right

    Well I guess if creating a variable for every object is the only way, I'll do that, it's just my project involves a lot of 'draggable' sprites so any where I can shave off code and variables I'd like too.

  • Thanks ikke2902 I'll look into this!

    I thought I'd follow up though by showing the demo of how it's working right now

    http://www.jmkit.com/mgame/dragouttest/

    If you notice, what happens the first time you click or drag over the ball.. The new sprite is created over the top of it (slightly bigger) but doesn't drag out.. However the next time you do the same thing, another new sprite is created but drags straight out O_O

    So I'm just a little confused why it can't do that the first time with the same code

  • Hello everyone

    I'm working on a project that involves the following example,

    I have a sprite of a BeachBall image with no behaviours, then a clone of that sprite with a drag and drop behaviour,

    the idea is that I'm using the first BeachBall sprite (with no behaviours) as a button that - when pressed - creates the second BeachBall sprite (with the drag and drop) over the top of the 'button' and instantly starts dragging it.

    So I made it look like this:

    It's almost there but currently what happens is that it creates the new sprite on top of the 'button' but doesn't let me drag it out with the same press, is there a way to tell the new sprite to start being dragged as soon as it's created?

    Thanks for any assistance