MatanK (4) [Avatar] Offline
Just read through the platformer chapter this weekend, and I have two things that bothered me and my suggested solutions (I don't know if these suggestions are any good, I have no experience in unity, but they seem to work for me).

1. Characters keeps "walking" in place if you press right after bumping into a wall

I solved this by replacing the order of events in PlatformerPlayer's Update, first setting the "speed" parameter based on velocity and only then updating deltaX (so that after bumping into the wall, the speed parameter would be set to zero even if the right button is pressed).

float currSpeed = _body.velocity.x;
_anim.SetFloat("speed", Mathf.Abs(currSpeed));
if (!Mathf.Approximately(currSpeed, 0)) {
  transform.localScale = new Vector3(Mathf.Sign(currSpeed), 1, 1);

float deltaX = Input.GetAxis("Horizontal") * speed * Time.deltaTime;

2. Even after unsetting "Has Exit Time" the animation seemed to go on for a little too long before changing state. I fixed this by going into "Settings" (below "Has Exit Time"), and setting "Transition Duration" to 0 instead of 0.25. Again, I have no idea if this is the correct thing to do, but it seemed to work for me.

By the way, this is the small platformer I developed to practice after reading the chapter:

jhocking (202) [Avatar] Offline
Great stuff! For 2, that is the correct way to do things, and I may even add that change to the errata after testing it out.

For 1, that's more of a design decision about how you want your game to behave. A lot of games have the animation play against the wall, but if you don't want that in your game, then your change is a good way to adjust it.

Regardless, great work figuring out an elegant way to customize the project in the book! Maybe I'll put that in the book as an exercise for the reader...

EDIT: Just saw that you customized the art and added an enemy, awesome! If I may make a suggestion, try making everything (movement, falling, etc.) faster. Right now everything feels like it's slow-mo.