Smooth movement during collision

0 favourites
  • 9 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hello forum. I've been testing out Construct 2 in order to try and create a HTML5 game for a school project.

    I'm interested in creating a prototype for a click-to-move game and I've found a good example for it called "Diablo Like Movement" or similar, I forget.

    Anyway, to the point: the example has an annoyance. As soon as the character touches the wall, he stops moving. In order to move again, the player has to guide away from the wall and not touch it again.

    Is it possible to smooth out the collision so the player glides smoothly against the wall and keeps moving in the direction of the mouse at all times?

    Here is the file: dl.dropbox.com/u/40408827/DiabloMovement.capx

  • Won't you need pathfinding?

  • I don't need pathfinding because I am not trying to create an isometric RPG where the player runs to the place you clicked, which is much more complicated, I believe.

    I want the player only to be able to move towards the mouse cursor only when he is holding down the mouse button, as seen in the example.

    I was assuming it only requires some slight modifications to my example as it seems to be working the way I want, except the smooth wall-collision part.

    To give you a better understanding, I want the walls to have the same effect as "Bound to Layout" does. Try walking out of the layout - you can see the player still moves towards the mouse but the character doesn't stop moving.

  • I really try to understand your question, but I dont understand it :D The wall collision is working for me.

  • Yes, the collision itself is "working", but it stops the player completely and the player gets stuck in the wall like glue. If you try to go outside the Layout Boundary, the player doesn't get stuck like that and instead the player slides smoothly against the boundary towards the mouse.

    What I want to know is if I can have that same "smooth" effect on my brick wall too, because that would make the game much more fun instead of trying to not touch the walls because you get completely stuck.

    I really don't know how else to explain what I'm looking for...

  • Based on playing the demo you provided I found the only annoying part to the sample is that when I run into a wall. The character will not move or slide along the even if my mouse has a lower or greater coordinate.

    This is what I think you want and what is happening?

    docs.google.com/drawings/d/1XBZR__-dh7mdBFvxNc7izP3io4S42lqCctBnNnDQcOE/edit

    one arrow is what is happening(is blocked based on linear direction)

    Where as the other area is the desired effect?

  • DiabloMovement2.capx (r111)

    I split the movement into separate horizontal and vertical movements so if it gets blocked horizontally it can still move vertically and vice versa.

  • Thank you so much ramones, this is exactly what I was looking for!

    As a novice looking at the event sheet, I could have never figured it out myself so thank you once more!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ramones, I was also trying to get something like this for a while! I tried pathfinders, but could never set them up right. This is a big help!

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