Unity 5.3 2D Footsteps Sounds

Unity 5.3 2D Footsteps Sounds

Tony Morelli

8 лет назад

8,895 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Half Eaten Loaf
Half Eaten Loaf - 08.06.2022 07:40

Thanks you came in clutch for this game jam

Ответить
Tom Vega
Tom Vega - 24.03.2021 02:26

OMG thank you !!!! the way they explained it in class was with a IEnumerator subroutine, found it difficult to understand.

Ответить
Icecreamer69
Icecreamer69 - 16.03.2021 07:55

When I do the other keys it only does one of em.

Ответить
Eddy Davila
Eddy Davila - 28.07.2020 23:30

You deserve an Oscar, sir

Ответить
Boiardie
Boiardie - 17.03.2019 21:03

big thanks

Ответить
RbLx _ GaMeRs
RbLx _ GaMeRs - 14.02.2019 22:25

could you please leave the script in the comments? i do a mistake it doesent work

Ответить
crxssed
crxssed - 04.02.2019 16:36

how do you make it so that if you are close to an object the sound gets louder (for example if you are near a chest and the chest sound gets louder so the player knows theyre near a chest?)

Ответить
EW
EW - 26.08.2018 20:23

how would i pause this sound when i'm jumping so that in the air if i go to the left or right, i don't hear footsteps until i've landed

Ответить
小霖
小霖 - 04.06.2018 06:45

what if i want to move left side with footsteps sounds?

Ответить
Arash Sh
Arash Sh - 03.04.2018 23:56

please help. how i use your code in my code?!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour {

public float maxSpeed;

bool grounded = false;
float groundCheckRadius = 0.2f;
public LayerMask groundLayer;
public Transform groundCheck;
public float jumpHeight;

Rigidbody2D myRB;
Animator myAnim;
bool facingRight;


// Use this for initialization
void Start () {
myRB = GetComponent<Rigidbody2D> ();
myAnim = GetComponent<Animator> ();
facingRight = true;


}
void Update(){

if (grounded && Input.GetKeyDown (KeyCode.Space)) {
grounded = false;
myAnim.SetBool ("isGrounded", grounded);
myRB.AddForce(new Vector2(0, jumpHeight));
}

}
void MoveRight(){
Vector2 position = transform.position;
position.x += speed;
transform.position = position;
}

// Update is called once per frame
void FixedUpdate () {
grounded = Physics2D.OverlapCircle (groundCheck.position, groundCheckRadius, groundLayer);
myAnim.SetBool ("isGrounded", grounded);
myAnim.SetFloat ("verticalSpeed", myRB.velocity.y);

float move = Input.GetAxis ("Horizontal");
myRB.velocity = new Vector2 (move * maxSpeed, myRB.velocity.y);
myAnim.SetFloat ("speed", Mathf.Abs (move));
if (move > 0 && !facingRight) {
Flip ();
}
else if(move<0&& facingRight)
{
Flip();
}
}

void Flip(){
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1f;
transform.localScale = theScale;
}

}

Ответить
Matt's Channel
Matt's Channel - 20.01.2018 18:19

This is kinda clunky. Footstep sounds need to start when the animation hits his feet to the ground.

Ответить
TheEletricboy
TheEletricboy - 28.03.2017 00:43

just saved me dude cheers

Ответить
Turceanu Cosmin
Turceanu Cosmin - 05.10.2016 20:14

thank you so much

Ответить
VNA·DJ
VNA·DJ - 18.08.2016 15:50

how can i stop the footstep sound while jumping?

Ответить
rage dev
rage dev - 29.06.2016 23:08

hey this is very good tutorial :) im not coder i try to make this to left side but i cant ;/ ehh

Ответить