Event condition- there is NOT a box at X,Y

This forum is currently in read-only mode.
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • So i need a condition which will determine if there is not a box at X,Y.

    To determine if there is one, i used

    for each box

    box.x=x

    box.y=y

    but if you do an else, it will check the first box to see if it is at x,y, then if the first box is not there it will go to the else. I want it to check ALL the instances, and if none of them are at x,y, then it determines there is no box at x,y.

    make sense?

  • right click any condition, invert condition.

  • yes, but what do I invert?

    obviously not "for each box".

    If i invert the box.x=x, then im just checking if theres a box at y and not at x.

    if i invert the box.y=y, then im jest checking if theres a box at x and not y.

    if i invert both box.x=x and box.y=y, then im checking if theres a box somewhere else.

    but theres fifteen boxes in the game- of course theres one somewhere else. i want to know if there is NOT one there.

  • private variable ('anybox')=0

    for each box

    ----if box at x

    --------if box at y -----anybox =1

    if anybox = 1, that means there is at least one box there

    else, no boxes are there

  • But what if the box moves? The variable still equals 1, but theres no box there.

  • perhaps a bit more information would help. i am making a game where the player picks up and moves boxes. Currently you can pick up the bottom box in a stack. That should not be. You should only be able to pick up the top box. So, i used the condition described at the begining to find out if a box was under another box. If so, it gets stuck. THe problem is, once the player moves the box above, the box below still thinks it's stuck.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if you set it to 0 before you do the for each condition each time it will be 0 if its not there, and 1 if it is,

    regardless of what the condition was in the last tick

    also, for what you described, the "is overlapping at offset" condition might be more appropriate

    and would be much simpler, though you'll have to use the family trick

    for instance

    box is overlapping "boxfamily" at offset x=0,y=-5

    make box immovable

    you have to do this with a family,

    as in : Box is overlapping Box

    it will think you want both boxes to be immovable

    so by separating the condition with a family, it understands the boxes you are overlapping

    are not meant to be picked for the actions

    example:

    drag and drop boxes

    http://dl.getdropbox.com/u/1013446/boxthing.cap

  • THANK YOU! Overlap at offset makes EVERYTHING in my life better. It made doing this a 30 second affair, not the 5 hour one it was, and it will make the other things that i need to fix eaiser.

    You are a lifesaver.

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