brackeys / 2d-animation Goto Github PK
View Code? Open in Web Editor NEWProject files for our tutorial on animating a 2D Character in Unity.
Project files for our tutorial on animating a 2D Character in Unity.
Crouching is constantly being turned on and off and the animation is looping from crouching to idle over and over. Also jumping animation doesn't play unless I'm already in the air and press space when it should activate when I am not touching the ground.
Anyone know what to do now?
once i create bones,the image disapper
Like the title says, for some reason when I jump it only plays the first frame for a split second before either turning into an idle or a run animation in mid-air, unless I press jump twice in which case the full animation plays out.
Edit: Watched the tutorial again and it turns out I just forgot to add something, my bad.
I tried following the tutorial and i got all the way to the end and when I tested it, it called the jump event both when it originally jumps and when it lands. any ideas?
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour
{
public movementScript ms;
public Animator animator;
public bool jumpAction;
private bool playerStopped;
private float stopTimer;
public float horizontalMovement;
public float runSpeed = 40f;
public bool jump;
public bool crouch;
// Update is called once per frame
void Update()
{
horizontalMovement = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(horizontalMovement));
if (Input.GetButtonDown("Jump"))
{
jump = true;
animator.SetBool("IsJumping", true);
}
if (Input.GetButtonDown("Crouch"))
{
crouch = true;
} else if (Input.GetButtonUp("Crouch"))
{
crouch = false;
}
if(stopTimer >= 10)
{
animator.SetBool("IsSitting", true);
}
else if(stopTimer < 10)
{
animator.SetBool("IsSitting", false);
}
}
public void OnLanding ()
{
animator.SetBool("IsJumping", false);
Debug.Log("Player Landed");
}
public void OnCrouching (bool isCrouching)
{
animator.SetBool("IsCrouching", isCrouching);
}
void FixedUpdate ()
{
// Move our character
ms.Move(horizontalMovement * Time.fixedDeltaTime, crouch, jump);
jump = false;
}
}`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.