Unity Record 2.2-Action-Animation, Camera, Debug and Summary

The first article and subsequent updates: https://mwhls.top/4453.html , no picture/no directory/format error/more information, please go to the first page to view. Please check mwhls.top
for new updates . Any questions and criticisms are welcome, thank you very much!

Summary: Unity Documentation

Summary: Rewrite the state of animation triggering, and use Debug to solve some problems for the first time.

Reference course: Super new Unity course Use Unity+C# to make 2D games Quick start to actual combat course 2D actual combat course

Animation Connection - 2023/02/16

  • The animation connection is relatively simple, just change the corresponding animation at the same time when performing each action.
    • However, you need to set the action separately for standing.
  • But there is a downside, the jumping animation is very strange.

Animation state rewrite - 2023/02/16 - 2023/02/17

  • It is a bit inconvenient to use the original state change triggered by the action.
    • So I rewrote the state detection and put it in PlayerAnimation, which just happens to have too little code.
  • After rewriting, some new states have been added, which are now:
    • stand up
    • move
    • jump
    • wall jump
    • float up
    • Floating
    • decline
    • sliding wall
  • I wrote it several times, and the final state switching effect is good, it is quite a process, and it can be seen what state it is
  • In addition, I wrote an additional speed variable to replace the original input judgment with the actual speed judgment.
    • There is an advantage that you can judge whether it is floating up or down.
    • Another unexpected benefit,
    • After hitting the wall, although it will not go in, the position will move to the inside of the wall, and then to the outside of the wall,
      • This caused me to have problems with the previous jump judgment, and finally changed a way to bypass it.
    • This speed in the opposite direction after hitting the wall does not change the actual position, but allows my character to detect that it is time to turn his head
      • That is, after hitting the wall, it automatically faces the side without the wall, which seems to be a great feature for the time being.
      • And the possible potential problem (the character cannot face the wall while sticking to the wall) can also be solved by facing the wall through two reverse short displacements after hitting the wall.
    • It was changed again the next day, and the input speed judgment was added as the front. Although it is good to hit the wall and turn back, it is not friendly to the operation.
  • In order to solve the misdirection when sliding the wall caused by the offset, I added a threshold for the zero comparison.

Camera - 2023/02/18

  • This part is pretty simple, just create a 2D camera and follow the character.

Debug-2023/02/18

Cannot double jump when falling - 2023/02/18

  • It is found that when falling directly from a high place to a low place, even if you have not jumped, you cannot use jump.
  • The test found that the recovery of the jump point is in the middle of the check function, and it cannot enter the recovery when it lands.
  • Rewrite the logic, move all the skill point recovery to update, and check is only used to judge and consume skill points.
    • Consumption of skill points can also be stripped, but it is not necessary, because it is in the last condition, passing must consume skill points.

Conclusion-2023/02/23

  • During the test yesterday, I found that there was a small problem with the animation, and there was an unexpected reverse speed of wall jumping.
    • Considering that when I read the tutorial, I found that there are still places that can be optimized in the code, and it is estimated that there will be many such things happening later, so it is not a big problem if I don’t change it for the time being.
    • When I think it's about the same, there is a high probability that these early codes will have to be rewritten and replaced with a more suitable architecture.
    • Before rewriting I should have the framework of the code ready.
  • It can be seen from the log time that it has been very busy recently, and the experiment has made considerable progress, but there are more new games.
    • Life is so fulfilling.
    • I decided to add private goods to the game, the name is the author's private goods, so that everyone can feel how fulfilled my life is.
  • I remembered why I didn't play games recently.
    • My Terraria bug is a bit serious, progress events need to be spawned manually, otherwise the first wave of monsters will disappear after clearing.
    • In the beginning, it was just a goblin invasion. A few days ago, a pirate invasion came. It was the same. I didn’t want to fight anymore. I was tired, and the buildings were too lazy to build.
    • It's better to make one yourself, and after a few years, you can always come up with something you like.
    • I don’t want to play other games either. After I bought XGP, I played Vampire Survivor and stopped playing after a few minutes. But I recommend the mobile version.
  • As the end of the stage, it is not good to use complaints as the title, so today's title is the conclusion.

おすすめ

転載: blog.csdn.net/asd123pwj/article/details/129342567