How do I keep the char's slide while passing through wall?

Get help using Construct 2

Post » Sun Jul 09, 2017 1:30 pm

Hi devdudes! ^_ ^

My game's character has a sliding movement to pass under narrow walls, similar to the classic MegaMan. However, depending on the starting point of the slide, this movement may stop while the character is still going through the wall.

What would be the best routine to make the character continue sliding if the move ends when he is under the wall?

I'm currently using a sprite in the pass-through scenario only via slide, which keeps the boolean variable of the slide active and the direction of platform behavior (left or right) to make the character pass automatically.

Image

Thanks for the attention and colaboration. :D
B
39
S
9
G
3
Posts: 261
Reputation: 4,361

Post » Sun Jul 09, 2017 7:30 pm

Well, how have you coded the slide? Are you able to add a collision test so that the slide always continues until clear of the wall / else slide lasts for the normal duration of the slide?

I'm speaking vaguely because without more information about how you've gone about this effect it's hard to say specifically what to do. Can you post some of your events?
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 8:36 pm

Hi @mikehive!

My character's slide can only be executed during his run (two taps in the directional, which double his speed while pressed).

The run and slide abilities use distinct boolean variables and the slide uses deceleration to slow the character down gradually.
B
39
S
9
G
3
Posts: 261
Reputation: 4,361

Post » Sun Jul 09, 2017 8:50 pm

Okay, so what if you set it up so that while slide boolean is true > every frame the player is under the wall the deceleration is set to 0 or 1 (or something really low) > else deceleration set to whatever you have it set at now, so that they move at constant speed until the end of the wall and then begin to decelerate on leaving?

Haven't tested, but just spitballing ideas :)
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 9:02 pm

mikehive wrote:Okay, so what if you set it up so that while slide boolean is true > every frame the player is under the wall the deceleration is set to 0 or 1 (or something really low) > else deceleration set to whatever you have it set at now, so that they move at constant speed until the end of the wall and then begin to decelerate on leaving?

Haven't tested, but just spitballing ideas :)


Right, but how will I identify that there is a wall just above the player's character?

C2 has two routines to identify ground below the player (Platform is on floor) and walls next to him (Platform has wall to left or right), but dont have to something above it.' :cry:
B
39
S
9
G
3
Posts: 261
Reputation: 4,361

Post » Sun Jul 09, 2017 9:22 pm

What about have an invisible collision sprite covering the space under the narrow wall, and test if the player is overlapping it?
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 9:31 pm

mikehive wrote:What about have an invisible collision sprite covering the space under the narrow wall, and test if the player is overlapping it?


I already did it this way and it worked out. I'm looking for some alternative, like identifying a sprite above the character while the boolean variable "slide" is active.
B
39
S
9
G
3
Posts: 261
Reputation: 4,361

Post » Sun Jul 09, 2017 9:45 pm

I suppose you could compare the Y coordinates of the player and the wall and check if the ceiling is within 10 pixels or however many.

OR! This is probably a better idea. Make a small invisible collision object and Pin it a small distance above the player's head. Then you just have to test if that collision object is overlapping any walls when performing slides.
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 9:52 pm

mikehive wrote:I suppose you could compare the Y coordinates of the player and the wall and check if the ceiling is within 10 pixels or however many.

OR! This is probably a better idea. Make a small invisible collision object and Pin it a small distance above the player's head. Then you just have to test if that collision object is overlapping any walls when performing slides.


Both solutions are good, but I would like a mathematical solution, comparing the Y axis of both objects.

I just don't know how to implement it. If anyone knows specifically, I'm very grateful to post here. :D
B
39
S
9
G
3
Posts: 261
Reputation: 4,361

Post » Mon Jul 10, 2017 10:39 am

This are the rough Basics ?
https://www.dropbox.com/s/kvqy27upqxkyy ... .capx?dl=0

If going to use a the deceleration to smoothly stop it sliding. Then i think you have to predict the distance.
https://www.dropbox.com/s/hpsjdfwjsj9o2 ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: kainrazial and 16 guests