How do I block movement for touch control?

0 favourites
  • 11 posts
From the Asset Store
Physics Block Puzzle game template for Construct 3
  • Hi everyone, I'm trying to make a game with C2 where I want to stop movement for both when player & any enemy collides with each other. My main player & the enemies have solid behavior, but for some reason they're not triggering at collision. I'm using touch event to move my players and custom movements to move enemies. Here is my capx,

    drive.google.com/file/d/1rlTkXvJz05tof658mXbaxsMveyxfGux9/view

    Please can somebody tell me what's wrong here? Need this help badly, thanks!

  • Link invalid.

    Put a few spaces after "https://" before the rest of the url.

  • fixed.

  • If you put something like "Enemy destroy" in event #18, you'll see that the collision between the enemy and player is triggered.

    To stop movement you can use "overlapping at offset" condition.

    For example, if your virtual joystick is between 316 and 45 degrees, check if player is overlapping enemy at offset X=+10. And if it is, set isCollide variable to 1.

  • If you put something like "Enemy destroy" in event #18, you'll see that the collision between the enemy and player is triggered.

    To stop movement you can use "overlapping at offset" condition.

    For example, if your virtual joystick is between 316 and 45 degrees, check if player is overlapping enemy at offset X=+10. And if it is, set isCollide variable to 1.

    Thanks for your reply. I did as you suggested for offset, and it works. But now another problem just came up, my character is stuck with the enemy since isCollide is fixed to 1. How do I revert back to 0 so that I can move again?

  • if player is overlapping enemy at offset, set isCollide to 1

    Else set isCollide to 0

  • Thanks again. I did as you mentioned but still not working. Am I doing something wrong here?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I meant something like this:

  • Thanks again, this is really working for left & right. But when it comes to up & down, player is stuck again. It seems I've to set the X,Y coords of the offset differently for Up-down. I tried by changing values many times but now I'm at a loss, what to do?

  • Try offset X=0, Y=10 for down,

    X=0, Y= -10 for up

  • Thanks a lot! Finally working now!

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