Make a game in under 15 minutes! - Unity 2D

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.พ. 2025

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

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

    Thank you so much, I’ve been searching everywhere for similar game ideas, yours hits the closest to what I wanna make!!

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

      I’m glad I could help!! I’ll try do some more one vid mini games in the future - they’re fun!

  • @kadamnable
    @kadamnable ปีที่แล้ว +5

    Great video !! 🦀

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

    At 6:00, my game throws an "Object is not defined" error even though I followed what you did. Can you help explain why that this?

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

      Could you send me the error it’s giving you?

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

      @@GameCodeLibrary Sure, here it is. PlayerMove is similar to your Player
      Tag: Boulder is not defined.
      UnityEngine.StackTraceUtility:ExtractStackTrace ()
      PlayerMove:OnCollisionEnter2D (UnityEngine.Collision2D) (at Assets/Scripts/PlayerMove.cs:150)

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

      @jazioxmugen looks like you need to create the tag “Boulder” on your object! In the inspector there’s a drop down at the top to add tags. It gives this error when that tag doesn’t exist

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

      ​@@GameCodeLibrary I have the tag set as "Boulder" though. That's where I am getting confused. I checked the spelling and everything but for some reason, the error still shows. The boulders hit the platforms and get destroyed and my player doesn't get destroyed as well. This is my code
      private void OnCollisionEnter2D(Collision2D collision)
      {
      if (collision.gameObject.CompareTag("Boulder"))
      {
      Destroy(this.gameObject);
      }
      }

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

      @jazioxmugen that is strange!!! Unity can break sometimes in weird ways, perhaps try closing down your project then reopening and seeing if it’ll work 🧐

  • @paballomolata8844
    @paballomolata8844 8 หลายเดือนก่อน

    Thank you very much, this is extremely helpful

  • @Badre-eddine81
    @Badre-eddine81 ปีที่แล้ว +1

    Thank you very much for the valuable informations

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

      You’re welcome!! I hope I can keep making videos that’ll help you in the future 🙏

  • @whoami-101_1
    @whoami-101_1 8 หลายเดือนก่อน

    Amazing video!!

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

      I'm glad you enjoyed!! :-)

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

    Heyy at 6:00 i am getting an error in the console tab saying "Trying to invoke method: Objectfallcontr.Fall couldnt be called the game is runiing bit the object is not falling from up

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

      Make sure your capitalization is correct when calling methods to invoke.
      This is how the script should be:
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class ObjectFallController : MonoBehaviour
      {
      float wait = 0.1f;
      public GameObject fallingObject;
      // Start is called before the first frame update
      void Start()
      {
      InvokeRepeating("Fall", wait, wait);
      }
      void Fall()
      {
      Instantiate(fallingObject, new Vector3(Random.Range(-10, 10), 10, 0), Quaternion.identity);
      }
      }

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

      @@GameCodeLibrary i wrote the same exact code but its not working still
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class ObjectFallController : MonoBehaviour
      {
      float wait = 0.1f;
      public GameObject fallingObject;
      // Start is called before the first frame update
      void Start()
      {
      InvokeRepeating("Fall", wait, wait);
      }
      void fall()
      {
      Instantiate(fallingObject, new Vector3(Random.Range(-10, 10), 10, 0), Quaternion.identity);
      }
      }

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

      The capitalization is wrong on your function:
      In InvokeRepeating("Fall", wait, wait);
      it's capital F
      Your void fall()
      is lowercase f
      Make them the same and it'll work! :-)

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

      Thanks it worked, i wanted to ask you if i wanted to. Make the game for android or ios what should i write in the player controller code so. It can move right or left

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

      @@magnificientcars9769 You'll have to look up a tutorial for that since it depends on how you want to move 👍 Good luck

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

    Hello, Thank you for this tutorial

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

      You're welcome I'm glad you enjoyed it!! I'll do some more making games in one vid sometime - they're fun :-)

  • @ST4R._.IS._.M3
    @ST4R._.IS._.M3 ปีที่แล้ว

    ❤ ur videos they help so much !! xx

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

      I’m so glad they help you!! I’ll keep making more so we can keep learning together 😌🙏

  • @Unknown-wx6td
    @Unknown-wx6td ปีที่แล้ว

    heyy!! i am having an error on 4:42 where you are adding the ObjectFallController script tag to the main camera i copied all the steps but when i am adding the script to main camera its showing "cant add the script component because the script cant be found and there is no errors in the script too

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

      Double check the name of the script within the script compared to the name of the script file in Unity! If they're different it doesn't work and can give this error :-)
      Hope this helps!

    • @Unknown-wx6td
      @Unknown-wx6td ปีที่แล้ว

      @@GameCodeLibrary thank you it worked but only one floating object is falling not multiple floating objects

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

      @Unknown-wx6td have you made the falling objects prefabs by dragging them from the hierarchy to the folder? Then delete the one in the hierarchy and use the prefab in your script slot.

    • @Unknown-wx6td
      @Unknown-wx6td ปีที่แล้ว

      @@GameCodeLibrary when i did that not a single object is falling

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

      @@Unknown-wx6td That's strange!! I can only suggest checking through the video again at the part of creating the objects - since I can't see your project to help out!
      Hope you can find the problem 🙏

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

    Every time I run this, my game crashes. Can you explain why?

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

      Nevermind, I figured it out! I added the script to my prefab when I should have just added it to the camera

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

    Hi and thank you for the tutorial. I'm just starting with Unity after using scratch for over 2 years - I'm 10 🙂
    I'm trying to work through your tutorial but think maybe my system is not right.
    When I go to add the the script 'PlayerController' yours says in the top left hand corner Assembly-CSharp. Mine says Miscellaneous Files (with a icon that says C#).
    When I enter your code some things are not highlighted in blue (MonoBehaviour as an example) could it be that when I create the script, that I somehow need to make sure that it opens with a screen that says Assembly-CSharp?
    If so, can you please advise?
    Appreciate any help :-)

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

      Hi!
      I have another video which should hopefully fix the problem you're having!
      th-cam.com/video/WWmFZGKaLII/w-d-xo.html
      Try following these steps and seeing if your scripts work now!

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

    Nice video!

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

    I am at 10:00 and when I try play the game it tells me "The type or namespace name 'Action' could not me found (are you missing a using directive or an assembly reference?)"
    I have used this code alongside a different player movement script I got from a different video I found before this, could it be something tied to that?
    P.S. I am very new to C# and Unity, so if it something obvious, that would be why :). Great tutorial by the way

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

      If there are no red underlines in your code, then check the name of your scripts compared to what they’re called inside!
      At the top, before the monobehavior bit, that’s the name of your namespace.
      That name has to match the name of your actual script file, otherwise Unity can’t find it.

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

    Hello, instead of making it game over, my game is about 3 aestroids with 3 point deduction, so 1 aestroid deducts 10 points the other 20 etc. my total points is 100, if the player collides with the aestroid is it possible to deduct score and there is also a timer. how can i do that?

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

      When we set the player to call the PlayerDied() action, instead deduct your points here - on collision. (Around 8:20 in the video!)
      Then when your points are 0 you can call the game over screen!
      I have another video on adding in a timer and showing the game over screen on timer end as well, you can check that out here:
      th-cam.com/video/T0atxxGoOlE/w-d-xo.html
      Good luck!

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

    Why am i floating when i used the falling thing

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

      I need help

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

      I don’t know!! Can’t see any of your code lol if you follow every step in the vid it’ll work 🙏 promise! There must be a little mistake somewhere!

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

    By any chance can you point me into the right direction where the crab has three lives?😅

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

      I have a video coming out on Friday where I add a player health with three hearts to our platformer game, but you can use the same method I do there for this crab game as well!! 😊
      But you’ll basically want a variable for the crabs health that decreases when hit. Then only call game over when the health variable is at 0! 🙏

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

      @@GameCodeLibrary you are my favorite TH-camr thank you so very much

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

      You’re welcome and thank you I’m glad you enjoy my vids!!! I’ll keep trying to make simple and fun tutorials 🙏