Smooth movement during collision

Get help using Construct 2

Post » Mon Dec 10, 2012 11:30 am

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: http://dl.dropbox.com/u/40408827/DiabloMovement.capx
B
2
Posts: 4
Reputation: 308

Post » Mon Dec 10, 2012 11:34 am

Won't you need pathfinding?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Dec 10, 2012 11:37 am

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.Jakyden2012-12-10 13:50:56
B
2
Posts: 4
Reputation: 308

Post » Mon Dec 10, 2012 3:00 pm

I really try to understand your question, but I dont understand it :D The wall collision is working for me.
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Mon Dec 10, 2012 4:30 pm

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...Jakyden2012-12-10 16:31:54
B
2
Posts: 4
Reputation: 308

Post » Mon Dec 10, 2012 5:17 pm

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?
https://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?
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Mon Dec 10, 2012 5:32 pm

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.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Mon Dec 10, 2012 6:19 pm

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!
B
2
Posts: 4
Reputation: 308

Post » Mon Dec 10, 2012 7:08 pm

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!
B
27
S
8
G
5
Posts: 429
Reputation: 6,902


Return to How do I....?

Who is online

Users browsing this forum: makotto, randomly, Walessio and 25 guests