Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by tuliocll · May 01, 2014 at 09:03 PM · 2d animationdouble jump

[Solved]Double Jump animation Unity 2D

Hi, How i Make double jump animation system using 2D mode in unity? I think this:

 if (Input.GetKeyDown (KeyCode.Space) && Pulo == 1) {
     anim.SetInteger("estado", 1);//Jump one
     }
     if (Input.GetKeyDown (KeyCode.Space) && Pulo == 2) {
     anim.SetInteger("estado", 2);//Jump two
     }
     if(!grounded){
     anim.SetInteger("estado", 3);// Falling animation
     }
 

But not work! :/

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by SunriseKingdom · May 02, 2014 at 07:02 AM

In my animator, I make a Parameter - Bool and name it Jump, and if it True the player go to Jump animation and if it false it go back to normal or walking animation.

But you also want a fall animation and one more jump animation, so create one more bool name it Jump2.

then in the animator under theirs condition use a Exit Time and set it to 5.00, that it will go into the fall Animation.

and on the fall animation set if jump and jump2 is false and Exit Time 8.00 go to Idle.

I post a Image so it will be easy alt text

Code

 var jump : boolean = true; //Can you jump
     var jumpspeed : int = 5; //How high you can jump
     var howmanyjump : int = 2; //How many jump you can make
     var addjump : int = 0; //Count up how many jump you made
     var anim : Animator;
      
      
     function Update () {
      
     if (Input.GetKeyDown (KeyCode.UpArrow))
     {
     if (jump == true)
     {
     addjump += 1;
     rigidbody2D.velocity.y = jumpspeed;
     anim.SetBool("Jump",true);
      
     if ( addjump == 2 )
     {
     anim.SetBool("Jump",false);
     anim.SetBool("Jump2",true);
     }
      
     if (addjump >= howmanyjump)
     {
     jump = false;
     }
      
     }
     }
     }
      
      
     function OnCollisionEnter2D(other : Collision2D)
     {
     if(other.gameObject.tag == "Ground")
     {
     addjump = 0;
     jump = true;
     anim.SetBool("Jump",false);
     anim.SetBool("Jump2",false);
     }
      
     }

hope this help.


image.png (81.1 kB)
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tuliocll · Jun 01, 2014 at 03:20 PM 0
Share

Very Tnkx $$anonymous$$an!!!!!

avatar image Vickylance · Nov 18, 2014 at 05:03 AM 1
Share

@Sunrise$$anonymous$$ingdom How do you make a transition from jump animation or jump2 animation to fall animation. I mean under what condition do they change and under what condition does the fall change to idle. Because if you are using time for each animation states then it wont be working most cases such as if you hit a wall on top or your landing platform is at different height or very below. So is it possible that we can trigger the idle animation if there is a downward motion in the y axis to be more acurate. I mean a transition from upward motion to downward motion,at that moment can I trigger the fall animation and let it play untill the player hits the ground where it will change form fall to idle anim?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is the best way to animate a 2D character? 2 Answers

Making player face the direction it moves (using angles). 1 Answer

Problem with friction. 1 Answer

How can I make a missile home to an enemy in arc fashion? (Unity 4.3 2D) 5 Answers

Splash screen for mobile devices 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges