How do I simulate drag-drop behavior with Move To?

0 favourites
  • 6 posts
From the Asset Store
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • I'm using drag/drop to control a character in a game I'm making, but unfortunately it allows for solid objects to be dragged through each other, and I can't have my Player going through walls.

    One solution I've read about is using "Move To" to re-create drag-drop behaviors, which should allow collisions to happen between solid objects.

    It seems like it should be simple to pull off, but I can't quite wrap my head around it.

    The way I'd like it to work is to have the object move relative to wherever I touch and drag (so you don't actually have to touch the player object, and I also don't want it to zoom over to where I'm touching).

    The best I can do on my own is this:

    + System: Every tick

    + Touch: Is in touch

    -> Player: Move to (Touch.X-Player.X, Touch.Y-Player.Y) (Direct)

    drive.google.com/file/d/16iLFCraaD_uxVoGWcS6ypj20Qnmch3-s/view

    As you can see there are a few problems. Namely:

    - The object moves just from tapping and holding, even without any dragging

    - When you do drag on the screen, the object moves kind of slowly and is not as "snappy" and responsive as the real Drag-Drop behavior

    - Also, after dragging, tapping anywhere just sends the object scrolling off the screen forever

    Thank you!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dropbox.com/s/2jw2ldko78dt4hz/pushit.c3p

    Thank you! However I noticed if you resize the walls and try to go through them on the opposite side, the player square is able to pass through.

    The walls in my game aren't just at the edges like in your example, they will be all over the place in different formations. Is there a way to make every side of a wall "solid" so the player won't pass through no matter what side they are on?

    Thanks again for the help!

  • Line of Sight has Raycasting.

  • Line of Sight has Raycasting.

    Hmm... can you elaborate? Sorry, I’m pretty new to game development!

  • Line of Sights "Cast a ray" can return the reflection angle if its intersected.

    However the behavior doesn't seem to be able to cast multiple rays in the same tick, so my idea wont work.

    No idea how to go about it otherwise. We just don't have great methods to deal with solid outside of the official behaviors for non coders, and I think even for those that code.

    It is a black box.

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