How do I allow any object to be dropped while check if valid

  • I have a game that has multiple like objects, I can get it to validate if I only allow for example animation frame 8 to instance 8 emptyBox. I can drag items of the same angle if I set less than or equal to for the animations frame but when I add the last item it doesn't come back with a completed "I Win".

    I am new to construct and normally in java use (1,4) to allow both anim 1 and 4 to be accepted and correct. I'm sure I'm missing something simple but for the life of me I haven't found the correct term to search or more likely I'm making an easy task harder than it needs to be. my capx is attached

    Any help you can provide will be greatly appreciated.

  • If I'm not wording this correctly please do let me know.

  • Something like this? ... .capx?dl=0

    I think you were looking for the "Or" block, which can be done by right clicking an event condition.

    I added a couple other things as well - No two lines can be dropped in the same place, picked up again after being placed correctly, and it doesn't matter which line you place in which position as long as it is the correct angle, it will count towards the goal. I don't know if this is what you want though.

    To save some work later, you don't need to give every emptybox/line unique instance variable IDs/animation frames, all the ones with the same orientation can be the same (0, 1, 2, 3, and 4 can just be 0; 5, 6, 7 can be 1; and 8 can be 3). Also, given that all your animation frames are the exact same sprite, you should probably use either the angle of the sprite or another instance variable instead of the animation frame to differentiate between the types of lines.

  • That was exactly what I was looking for, much appreciated and so much more concise than my brain made it. I'm now going to try and wrap my head around what I believe you mean in the last paragraph.

    If I understand correctly for say the vertical line emptyBox I could use instance 0 and then just duplicate the number of times needed and the same with the vertical lines themselves thus I could spawn more vertical lines if I wanted and they would work.

    Also the set drag drop disabled after drop was something I was trying to figure out since I kept dropping lines into the same containers.

    Thanks again for such a concise and well explained fix, as a newbie you are a godsend.

  • just a thought..


  • That is an interesting take as well Korbaach. A major part of my task with this is to have the lines moving but that looks like it should be easy enough though now I have overlapping lines myself when they come back in from out of bounds. One thing I noticed was that second batch of lines was short of the number the master grid was producing is it that the lines produced are possible outside the bounds of the layout? I must add how amazing it is that you guys take the time to work out other peoples issues.

  • Hey guys, I've been playing around with both of your capx files and both have really awesome features. I have a couple questions on them.

    oosyrag I can drag and drop them but when it passes over the first available drop spot it snaps to it and doesn't let me drag it any further, is there a drop only on release option that would let me pick the destination I want to drop the lines?

    Korbaach, I love the random create on yours but I can't figure out how after completing the first puzzle it is creating the second puzzle with more lines in the master map than are generated to drag. I have changed both the chooseLine function repeat and the dragline onPlace but it doesn't seem to make any difference minus the number of draggable items that are created.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea..sorry..I forgot to set previous lines invisible...

    you need to add action:

    anyway..I fix the dragLinesBullet.capx and added a new variable lineNumber

    so.. every time you solve the "map" get another line...

  • Thanks, very useful information.

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