prime31/CharacterController2D

DemoScene bug: Pressing Up & Down causes jump at 3x velocity

Closed this issue · 2 comments

if( _controller.isGrounded && Input.GetKeyDown( KeyCode.UpArrow ) )
{
	_velocity.y = Mathf.Sqrt( 2f * jumpHeight * -gravity );
	/* ... */
}

/* ... */

if( _controller.isGrounded && Input.GetKey( KeyCode.DownArrow ) )
{
	_velocity.y *= 3f;
	/* ... */
}

_controller.move( _velocity * Time.deltaTime );

Due to the above code, player can press up & down arrows simultaneously to launch themselves into the air at 3x jump velocity.

Also, I would love to purchase this as an asset on the asset store to support your work, if you are interested in selling it or other quality 2d assets!

The example in the demo scene definitely is not a production input system. It is just the bare minimum amount of code to setup a demo of how the CC2D works.

There may be something coming to the Asset Store (a revamped and full-fledged CC2D) but no guarantees unfortunately. It is for a project where I do not get to decide the fate of the code so it’s in someone’s elses hands at the moment.