Code Monkey home page Code Monkey logo

2d-animation's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2d-animation's Issues

Crouching and jumping not working right

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.

Jump Animation only plays for one frame

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.

Calls jump function multiple times.

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;
}

}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.