How do I set bound on object?

0 favourites
  • 3 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • hi all please help

    how set bound limit on object? i using bounded drag and drop

    i want to set limit like this

    in the second image is correct

    but in the 3rd picture it exceeds the syringe

  • try using this format, and i suppose the syringe pulley with rubber is a different sprite than the syringe itself. Let for this example name them object2 for syringe body, and object1 for syringe movable part.

    Everytick > object1. set position. to object2.x, object2.y
    
    On Touch is Touching 
    If touch.x greater than object1.x >action> object1. move at angle 0 > min(distance(Touch.X, Touch.Y, object2.X, object2.Y) / 3, distance(object2.x,0,object2.bboxRight-20,0))
    
    

    in theory should work the same as the physics catapult game example but only towards angle 0 no Y no other stuff.

    and limited to the length of the syringe body X position (please check origin point in animation frame they have to be similar) to syringe body bbox-right or right edge... since we don't know for sure exactly what that image size is... from needle to a 20% near popping the interior pulley out.

    no need for drag and drop behavior at this point.

    here is the code as an example file

    Edited: wait what behavior is that boundedDrag&Drop? is that a custom behavior or official? :O never seen it lol. in theory should be the same as my code... set boundry min to 0 max to 170 or so... depends on your syringe size length... also make sure you trigger the drag and drop only if the mouse.X is greater than the syringe body X and syringe body X needs to have image point near the needle or where the needle meets the plastic area.

    Huh website is acting strange, well that is it for me... to many fiddling on this product... never polished or finished. Hope it helped OP! :) i have to go to work now! have fun.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • THANK!! it works

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