How To Make Any Game Mechanic - Episode 1 - 2D Movement

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2024

ความคิดเห็น • 20

  • @ThatOneUnityDev
    @ThatOneUnityDev  ปีที่แล้ว +1

    Don't forget to suggest a game mechanic you want to see in a future episode! :)

    • @Soundy777
      @Soundy777 ปีที่แล้ว

      Loving your content! More please!

  • @fatpenguin_
    @fatpenguin_ ปีที่แล้ว +1

    This series is gonna be wild, and hopefully help me with my problem in different episodes 😄

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว

      Thanks for watching! If you have any suggestions, let me know! :)

  • @lemmin_
    @lemmin_ ปีที่แล้ว +1

    This playlist has a lot of potential!
    I don't want to suggest anything too complicated, but I actually care about programming practices (SOLID principles, event-driven, component-based, scriptable object architecture, etc...), and you could try making a basic 2D jump that can be reused and customized from the inspector (i.e. reusing the same code for both the player and another character, and have the same code available for multiple projects to have different behaviors that can share the same functionality and still be used in different ways, just to give an idea). Also remember to take your time!
    If you choose to just focus on the mechanics and want something spicy, try a Yoshi jump or a mid-air dash that happens only after you press down the horizontal input when the player character is mid-air and falling.

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +1

      Thanks for the suggestions! There may or may not be a jump coming already ;) .. Although a dash would be really fun to implement! :)

  • @Ghareebz
    @Ghareebz ปีที่แล้ว +1

    the idea is really cool , Just To be Focusing More on the Algorithmic Side

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว

      Thanks for watching! Glad you enjoyed! :)

  • @DigiLena
    @DigiLena ปีที่แล้ว +2

    Really excited for this series as I am just learning scripting. Any sort of fight mechanic would be cool (I have a pirate with a sword as my first character).

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +1

      Combat is a little tricky, but I'll see what I can do! :)

  • @Soundy777
    @Soundy777 ปีที่แล้ว +1

    GRAPPLING HOOK!

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +2

      Haha, I will have to do that for sure!

  • @PinkTreeArts
    @PinkTreeArts ปีที่แล้ว

    I'm wondering if the transform method you entered would have any impact on the gravity, since you didn't try playing from the start on transform mode

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว

      I'm not entirely sure what you're asking? Gravity acts per normal using the transform method. If you want to check, I use it in the newest grapple gun episode. :)

  • @CSharpGameDev
    @CSharpGameDev ปีที่แล้ว

    There's something about the Rigid Body approach that doesn't seem to fully work right. I noticed the code for the first part doesn't seem to utilize the moveSpeed variable at all so it doesn't affect the move speed when you adjust the value in the editor. That's why it didn't seem to change when you adjusted the value. I multiplied the rb.velocity.y by the moveSpeed and Time.deltaTime and it works but the value has to be something ridiculously high like 500 to feel right. The issue is it also affects the downward movement on the x axis so if the player object is slightly above the ground object when you start the game with those values and the bool not checked, the player plummets right through the ground. I'm still kind of new to this so maybe I'm missing something. Has anybody else had this issue?

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +1

      Haha, that's quite the oversight! Your absolutely right! I will have to make a note of that, and update the github to utilize the movespeed variable for rb movement! As for having to use a ridiculously high number, you could always remove the time.deltatime, and your numbers will be MUCH lower. I'm a little confused by the way you worded your last issue. Using transform movement, your player falls through the ground?

    • @CSharpGameDev
      @CSharpGameDev ปีที่แล้ว

      @@ThatOneUnityDev Thanks for the response! I noticed when I tried adjusting the value to something like 2500 and the move speed didn't change which made me go back to see what the issue was. I'll try it again without Time.deltaTime and see if that does anything but after watching another video that used the Rigid Body component, I can see that those values might just be normal when using physics. 500 move speed seemed high at first in comparison to the transform movement only needing like 15.
      I might have misspoke on the last issue but it was regarding the Rigid Body movement. Basically if I hit start with the movement speed value set to 500, the player can move faster left to right, but if the player is set slightly above the ground object at Start, the player is affected by the move speed value downward as well which makes it drop so fast that it will clip right through the ground object.

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +1

      @@CSharpGameDev Hmmm, That's really odd! Are you by chance changing the y velocity as well? You should only be changing the x velocity. So the new code would look something like rb.velocity = new Vector3(x * moveSpeed, rb.velocity.y, 0);
      The rb.velocity.y for the y velocity essentially tells the rigidbody to leave the y velocity alone, and keep whatever it currently is. The only difference between this new line and the video, is the inclusion of the move speed variable for the x, which I forgot.
      With the move speed variable set to something like 5, you should notice the 5X faster rigidbody movement.

  • @DigiLena
    @DigiLena ปีที่แล้ว

    In the unity tutorial they end up moving the movement to fixedUpdate to stop jittering. I see you didn’t do that here. Is that not necessary?

    • @ThatOneUnityDev
      @ThatOneUnityDev  ปีที่แล้ว +1

      It is better practice to do the input in update, and the actual movement in fixed update, for the rigidbody movement. Physics is handled on fixed update, so anything physics related should be in there.
      However, creating more complexity in the code to allow for that, in my opinion, would only discourage beginners.
      While good practices are best learned early, I wouldn't get to caught up in the small details. Just be excited that your character can move, and work on the next mechanic! All those 'best practices' can come later, after you can create simple games, and see if game dev is right for you! :)