Week 11 – UmLet ReMovement Code

The following UmLet is for the ReMovement Code that I am doing this week.

ReMovement.cs

jumpSpeed and normalSpeed are used for the jumping and movement mechanics, as they are treated separately, they allow modification as desired for each mechanic

change is the float which retains the normal speed value and is modified as to change the player to various speeds as desired

ch is the variable which allows the modification of the speed, depending on the button pressed

horizontalAxis retains the value that is used when moving either left or right, between -1 and 1

jump is a boolean used to determine when the player can jump, in this case when the button for jump is pressed

rigidBody makes the connection to the RigidBody, which allows the adding of a force, as to make the player jump

rightFacing and leftFacing are quaternion variables which allow the change of direction by modifying the rotation of the transform of the gameObject

canSneak, canRun and walk are variables that allow the change of speed, by retaining if the specific button has been pressed

direction is the variable which manages the direction the player is facing

canJump is a bool variable which allows the player to jump if it is true, modifying this value is what actually allows the player to jump, being true only when the player is touching the ground

The Jump() method and OnCollisionEnter() are used to make the jumping mechanic possible, first one by containing the code for jump, and the second one gives the conditions on when the player can jump.

The result of the code that is based on the variables fulfills all the objectives noted in the UmLet.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s