Moving Platforms - 2D Platformer Unity #21

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

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

  • @mariopaskalin8419
    @mariopaskalin8419 11 หลายเดือนก่อน +1

    Quick and simple videos. Looking forward for more! 👍

  • @xxispade
    @xxispade 2 หลายเดือนก่อน

    Great job on the video! Keep them coming!

    • @GameCodeLibrary
      @GameCodeLibrary  2 หลายเดือนก่อน

      Thank you I appreciate it!! 🙏

  • @trevortrev6789
    @trevortrev6789 11 หลายเดือนก่อน

    As superficial as this is, I subbed simply because of the Mother 3 song you use at the end of your videos. I don't have a need for any of the tutorials you've put out yet but I'm still going to keep an eye on your channel!

    • @GameCodeLibrary
      @GameCodeLibrary  11 หลายเดือนก่อน

      Haha that's fair!!
      The next series I'm planning will be a top-down turn based rpg game, somewhat similar to the earthbound games! (Mixed with final fantasy too... a medieval mother 3?! :p) Hopefully there'll be something in those that might be more interesting for you :-)
      Thanks for the support!

  • @gabrielcesconetto3443
    @gabrielcesconetto3443 11 หลายเดือนก่อน

    So glad I found your channel! It's perfect, thank you so much 😊

    • @GameCodeLibrary
      @GameCodeLibrary  11 หลายเดือนก่อน +1

      I’m glad you found it too 😌 excited to keep learning together!!

  • @globes179
    @globes179 11 หลายเดือนก่อน

    How can you make the platform kind of bounce under the weight of the player's jumping on it? I mean, when the player jumps onto the platform, it sinks a little, like a cushioning effect?

    • @GameCodeLibrary
      @GameCodeLibrary  11 หลายเดือนก่อน +2

      Hi!
      You could add a script to your platform that checks for a collision with your player, and when collided you could start a coroutine that lowers the platform (can use Lerp to lower over time, or move towards) and then wait a short moment before raising the platform back up!
      This should simulate a bounce

  • @rragy1848
    @rragy1848 4 หลายเดือนก่อน

    I like your videos, but I sometimes struggle to keep up, maybe if you do it slower, would be better for all of us. But otherwise thanks 100 times for free content like this! ;)

    • @GameCodeLibrary
      @GameCodeLibrary  4 หลายเดือนก่อน

      Yeah I think I edited them to be too fast!! :p I didn't want people getting bored, but also that makes it hard to follow along!
      I've tried slowing it down in my latest vids - I'll keep it in mind and chill out a lil more hahaha
      Thank you and you're welcome :-)

    • @rragy1848
      @rragy1848 4 หลายเดือนก่อน

      @@GameCodeLibrary How long did it take for you to learn C#?

    • @GameCodeLibrary
      @GameCodeLibrary  4 หลายเดือนก่อน +1

      @@rragy1848 I used it at uni for 3 years and I'm a senior software dev atm using c# in my day job - which I've been at for almost 5 years! So that's 8 years now wow that's so long lol... I've been doing game dev in my own time all those years too! :-)
      But honestly I don't use a lot of my work skills in game dev - I simplify the code for games as much as I can since it can become bloated fast with features added!

    • @rragy1848
      @rragy1848 4 หลายเดือนก่อน

      @@GameCodeLibrary 8 Years in total, is quite a long time.. I started to learn Unity nearly a year ago, but it doesn't go that easy. But hopefully one day will be better..

  • @HappyElephant404
    @HappyElephant404 6 หลายเดือนก่อน

    Firstly I wanted to say that this is a really great video, short and clear.
    I have a very interesting bug, so if you don't mind, I have a question for you. Before the platform changes direction for the first time (before touching any of the points), its speed is less than it should be. Platform movement speed is not tied to distance so it shouldn't affect as far as I understand.
    This way of creating moving platforms is common, but I haven't seen anyone talk about this problem, so maybe it's just me. I will leave the code under this comment. if necessary, I will remove it. Thanks in any case.

    • @HappyElephant404
      @HappyElephant404 6 หลายเดือนก่อน

      using UnityEngine;
      public class MovingPlatforms : MonoBehaviour
      {
      public Transform pointA, pointB;
      public float moveSpeed;
      private Vector3 nextPosition;
      void Start()
      {
      nextPosition = pointB.position;
      }
      void Update()
      {
      transform.position = Vector3.MoveTowards(transform.position, nextPosition, moveSpeed * Time.deltaTime);
      if (transform.position == nextPosition)
      {
      nextPosition = (nextPosition == pointA.position) ? pointB.position : pointA.position;
      }
      }
      private void OnCollisionEnter2D(Collision2D collision)
      {
      if (collision.gameObject.CompareTag("Character"))
      {
      Vector2 contactNormal = collision.GetContact(0).normal; //What is it and why is it here(^-^)? Just kidding, this is a necessary change for my game.
      if (Mathf.Abs(contactNormal.y) > Mathf.Abs(contactNormal.x))
      {
      collision.gameObject.transform.parent = transform;
      }
      }
      else
      {
      nextPosition = (nextPosition == pointA.position) ? pointB.position : pointA.position;
      }


      }
      private void OnCollisionExit2D(Collision2D collision)
      {
      if (collision.gameObject.CompareTag("Character")) collision.gameObject.transform.parent = null;
      }

      }