HELP: Movement stops on platformer
ookami007
Member Posts: 581
I am starting off making my platform engine and have run into a problem. When holding the right key, the player starts to move right but then stalls and stops. Moving left works perfectly.
I'm using the same bit of code for each with the exception of the set linear.x to -150 or 150
If game.moveright then constrain linear.velocity.x to 150
If game.moveright then constrain linear.velocity.x to -150
I also test if neither is push and set linear.vlecoity.x to 0
I've put log statements in and it shows that moveright is still active even when it slows down... when I release the key, the stop is initiated... but not before.
Any ideas?
Comments
So it looks like I found the issue... in the right movement I accidentally used a SET ATTRIBUTE instead of a CONSTRAIT attribute...
So what really is the difference between a constrain and a set?
I'm guessing that constrain will keep it at 150, whereas setting starts it at 150 but then is degraded by friction?