Unity 2D: Animation Part 5 - Jumping Anim and Code

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

I like that you teach in such an unprepared way, it's easier to follow your thought process that way. :)

MagmaMusen
Автор

You helped me more than the unity oficcial tutorials, thank you very much man. Keep doing videos,

sirAlfred
Автор

Exactly what I have been looking for.. Love the tutorials

SuspenseGames
Автор

Hey Paul, just wanted to say thank. Your videos got me where I needed to be. I hope to see more sometime. Take care.

nathancoupal
Автор

Hi Paul,
at first i really want to thank you for these tutorials.
But i have a question left. Why all these triggers und float variables for the jump animation. I tried it by using the grounded boolean only and it worked too.

wurstmitbrot
Автор

Interesting videos. Question : After getting the package for Tim's sprites and animations, is it possible to keep the same code for Tim and add your own sprite with the same names as Tim's? Basically what I'm saying is, is it possible to add my own sprite with that same code there? I really like how the code works so fluently.

orangelimesky
Автор

Hey Paul... I am having some trouble creating projectiles with instantiate. Any chance you could post a tutorial on this soon? Great videos!

rennyd
Автор

Thanks very much, your video help me create triggered events in my project :)

GrahamThomson
Автор

Thanks for the series Paul. Do you have any tips on doing a 'bridging' animation between animations jump and idle?

Edit: There also seem to be a delay before the transition into the Idle animation because speed takes a while to get back to less that 0.1 when the Horizontal keys are held down.

runhidesleepeat
Автор

Your tutorials are awesome, but the order is so messed up :(

GeemanKan
Автор

You are the best!!! thanks a lot and keep doing videos!!

rashasalim
Автор

i have a problem, when i jump it works fine but when i fall back down it just shows the idle for a split second then stays on the jump animation but can move just stuck on the jump animation.did everything u did double checked and i cant find the solution to this plz halp heres my code [nevermind i fixed my problem lol i switched the {public float speed = 6.0f;} to {public float speed = 0.0f;} as well as making the the both "Jump" in Animator into Has Exit time boxed checked and is at 0.25, also had fixed duration box checked on the jump on jumping transition and on land going to run transition) i dont know ifu got that cause this is lot of info and idk if this will work for u or not but this problem pissed me off until i fixed it so yeah hope this helps. thanks...




using System.Collections;

public class Movement : MonoBehaviour
{
public float speed = 6.0f;
public bool grounded = false;
public Transform groundedEnd;

float jumpTime, jumpDelay = .1f;
bool jumped;

Animator anim;

void Start()
{
anim = GetComponent<Animator>();
}

void FixedUpdate()
{
Moving ();
Raycasting ();

}


void Raycasting()

{
Debug.DrawLine (this.transform.position, groundedEnd.position, Color.green);

grounded = Physics2D.Linecast (this.transform.position, groundedEnd.position, 1<<
}

void Moving()
{

anim.SetFloat ("Speed", Mathf.Abs(Input.GetAxis ("Horizontal")));

if (Input.GetAxisRaw ("Horizontal") > 0) {
transform.Translate (Vector3.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2 (0, 0);

}
if (Input.GetAxisRaw ("Horizontal") < 0) {
transform.Translate (Vector3.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2 (0, 180);

}
if (Input.GetKey (KeyCode.W) && grounded == true)
{
* 121f);
jumpTime = jumpDelay;
anim.SetTrigger("Jump");
jumped = true;
}

jumpTime -= Time.deltaTime;
if (jumpTime <= 0 && grounded && jumped)
{
anim.SetTrigger("Land");
jumped = false;
}
}
}

rrrush
Автор

I fixed the jumping but now that I can jump I can't move left or right, help ?

domwilson
Автор

Tutorials are great and everything in my code is working well except jumping. Any ides why my jump button (space) will not work at all?

theredview
Автор

Hello this video helped me but i have one problem, when my player jumps he takes forever to come back down. Plus he doesn't wait to come back down before he starts moving again, he runs in the air. I would like for my player to come back down before he starts running like your player. How do I fix this? help me please :(

Jayvalova
Автор

I noticed it's been a month you published all these tutorials. I don't know if you plan to go on but would be best if you touch a little bit to 3D controls in future. Anyway, these videos are really helpful. Thanks for effort.

anldemir
Автор

I like these tutorials, but i also feel that i must point out I find the adding of the 'jumped' variable part really confusing at ~10:00. Why exactly does this fix the problem? I dont see why from the code, nor is it explained. 

Woflborg
Автор

How come I can't jump? I tried your tutorials on jump functionality. The issue is not on jump animation but on the functionality of jumping.

daviddimalanta
Автор

My character is floating and I don't know why, I set t

domwilson
Автор

i was wondering if you could add a crouch to this code and how you would go about doing it
 can you map the jump and crouch to the vertical axis

AllinAllGames