Deacceleration of player when switching controls?

Get help using Construct 2

Post » Sat Nov 29, 2014 1:40 pm

I have a player that switches between platform controls and 8direction input if it encounters a ladder. Although if it encounters a ladder while pressing left or right it will just pass it by unless it presses up or down to climb. My problem is that if left (or right) is pressed down (and not released), it passes a ladder by, but also slows down (specifically the vector x drops). So every time the player encounters a ladder, it slows down at the same time the controls are switching from platform to 8direction input. I have made sure the platform values (e.g. acceleration, deceleration, and max speed) match the 8direction values but it doesn't make a difference. I tried setting the 8direction vector x value to the platform vector x value but that creates a new problem with the player moving slowing through the ladder if it started slow. Any ideas? This is my first forum post :D Thanks in advance!
B
3
Posts: 8
Reputation: 191

Post » Sun Nov 30, 2014 3:14 am

Maybe you ought to start off with 8direction disabled. Then go:

If player is overlapping ladder & Player is pressing UP or DOWN
--Activate 8direction
Else
--Deactivate 8direction

If you are still stuck, it always helps to post a capx.

Welcome to the forum. :)
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Sun Nov 30, 2014 7:25 am

Thank you for helping, however, I already have my "code" setup like that. Here is the capx though: https://www.dropbox.com/s/3mzn7rwzthbup ... .capx?dl=0
B
3
Posts: 8
Reputation: 191

Post » Sun Nov 30, 2014 8:39 pm

@SarcasticNash

EDIT: Nevermind...got dropbox to work.

Dropbox is acting up on me today...could you post the capx as a forum attachment?
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Sun Nov 30, 2014 10:12 pm

I built a new example with your assets. This version uses tilemaps. The code is a lot simpler; only 5 events. ;)
You do not have the required permissions to view the files attached to this post.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Mon Dec 01, 2014 2:16 am

Thank you TiAm! It is so simple and beautiful, it is a work of art! I have a lot to learn. Guess I also need to spend more time learning about tilemaps too. Are there any good tutorials that deal with tilemaps and random generation?

EDIT: Now that I am looking around a little more I've found some great tutorials/examples, I guess I just based my ladder stuff on bad ladder examples. Thanks again. :-)
B
3
Posts: 8
Reputation: 191

Post » Mon Dec 01, 2014 3:04 am

Glad I could help...good luck with your project. 8-)
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Fri Dec 05, 2014 11:49 pm

I've integrated the code into my game and have noticed some problems such as my player falling slowly through the ladder even though gravity is at zero. When I go back to the capx you provided I have found some of the same problems, especially if you delete the tiles above the character to give a bit more room. You can get the character to fall through the ladder if you test it going up and down. Any idea why this is might be occurring?
Last edited by SarcasticNash on Sun Dec 07, 2014 5:24 am, edited 1 time in total.
B
3
Posts: 8
Reputation: 191

Post » Sat Dec 06, 2014 5:52 am

Whoops :)

I forgot to clear the Y vector of movement when the player overlaps the ladder. Otherwise the player is stuck in a perpetual 'jump' or 'fall'. Here's an updated capx:

https://www.dropbox.com/s/qfaa1ghcm6h9z ... .capx?dl=0
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Sun Dec 07, 2014 5:24 am

Solved all my problems. Thanks again!
B
3
Posts: 8
Reputation: 191


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, MaujDeveloper and 5 guests