Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var movement : float;
- var jumpstrength : float;
- var jumpincrease : float;
- var jumpmax : float;
- var jumpbool : boolean;
- function Start () {
- jumpmax = 20;
- }
- function Update () {
- if (Input.GetButton ("Horizontal")){
- transform.position.x += movement;
- }
- if (Input.GetButton ("NegaHorizontal")){
- transform.position.x -= movement;
- }
- if (jumpbool == true){
- if (Input.GetButton ("Jump")){
- jumpstrength += jumpincrease;
- if (jumpstrength >= jumpmax){
- jumpstrength = jumpmax;
- }
- }
- if (Input.GetButtonUp ("Jump")){
- rigidbody.velocity.y += jumpstrength;
- jumpbool = false;
- jumpstrength = 6.5;
- }
- }
- }
- function OnCollisionEnter () {
- jumpbool = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement