Coin Pickup System - Unity 2D Platformer

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • In this new Unity Tutorial, we're gonna implement a simple coin pickup system and use the PlayerPrefs to store the number of coins without losing them.
    ● Project Files: github.com/Cha...
    ● Playlist Link: bit.ly/3dg1X88
    ● Game Assets: bit.ly/3xVVLtJ
    ♥ Don't Click This! : bit.ly/2Zi3vu9
    ♥ My Second Channel: bit.ly/3jvI8g6
    --------------------------------------------------------------------
    ► Best Budget Gaming PC (Affiliate links):
    5) HP Pavilion 15.6": amzn.to/3aPo8kj
    4) Dell G3: amzn.to/3e5EJlP
    3) ASUS TUF FX504: amzn.to/3e3jWPD
    2) Acer Nitro 5: amzn.to/32YqcC2
    1) Lenovo Legion 5: amzn.to/2R9P5Z1
    --------------------------------------------------------------------
    FOLLOW ME:
    ● Facebook: / developer3.5pro
    ● Twitter: / chaker_gamra
    ● Sketchfab: sketchfab.com/...
    ● Website: chaker-gamra.h...
    --------------------------------------------------------------------
    ► All content by GDTitans is 100% free. I believe that education should be freely available to everyone.

КОМЕНТАРІ • 85

  • @gory_t4293
    @gory_t4293 2 роки тому +9

    Thank you, but I think there's still a problem, if start a new level the coins don't reset, I mean it keeps counter the previous level's coins, how can i reset the coins in every single level, and just add the new coins+previous coins in the menu scene? Thansk

    • @KazeChannelKC
      @KazeChannelKC 2 роки тому

      I want it like that too, have you solve it?

    • @sogyshorts5662
      @sogyshorts5662 Рік тому

      I need same help too I am not alone

    • @huytan8249
      @huytan8249 7 місяців тому

      Creat a key to save number of coins in main menu, after finish a level, plus a collected coins to number of coins in main menu and set coins after level to 0

  • @axelsmaxel
    @axelsmaxel 2 роки тому +1

    I love you, you helped me with like 5 problems in one video! please continue making videos, you're great at it

    • @GDTitans
      @GDTitans  2 роки тому +1

      Thanks 😊 I really appreciate it

  • @KazeChannelKC
    @KazeChannelKC 2 роки тому +2

    Hi how do you reset the coin when you restart the game? because every game does that.

    • @MyMusic-pi6lz
      @MyMusic-pi6lz 2 роки тому

      Same... Plz tell me if u found the ans....

  • @modnashri
    @modnashri Рік тому +1

    how i can reset the coin on the player level when the game start to 0 zero
    so when he go to the shop all coins he collected there

  • @hemmikotlin2589
    @hemmikotlin2589 2 роки тому +2

    hi, how to save the number of coins at the end of the level, and what if when we lose them it was 0 again, and when we passed the level, the coins were saved

  • @HansBermeo
    @HansBermeo Рік тому +1

    Hi! I have a problem... if I exit the game and open it, the coin counter stays the same number as the last time I collected it but if I collect coins again, it resets to 1

  • @Eldoctor314
    @Eldoctor314 2 роки тому +2

    So how can I display the total of coins that have been earned in a different scene. Like the main menu.

    • @GDTitans
      @GDTitans  2 роки тому +2

      Use playerprefs.GetInt to get the number of coins 🪙

  • @masterchief3902
    @masterchief3902 3 роки тому +3

    Please tell how to add sound when we pick up a coin

    • @GDTitans
      @GDTitans  3 роки тому +2

      In the next tutorial

    • @masterchief3902
      @masterchief3902 3 роки тому +1

      @@GDTitans sir also tell that how to disappear the collected coins before a particular checkpoint
      Like I dont want to display the coins i collected after dying after a checkpoint

    • @masterchief3902
      @masterchief3902 3 роки тому +1

      @@GDTitans one more question that how to disable the checkpoint function
      Like if I had saved at 1st checkpoint and then save at the 2nd checkpoint , I should not be able to save at checkpoint 1 again
      Please tell this also sir

  • @yasser_gg2276
    @yasser_gg2276 6 місяців тому +1

    perfect and eazy tutorial THX bro

  • @Roughartwork
    @Roughartwork 2 роки тому +1

    Thank you for tutorial ✌ i learned new methods thank you so much 😊

  • @ohno5888
    @ohno5888 2 роки тому +2

    great tutorial you always help me so much :)

  • @zolagibrar6864
    @zolagibrar6864 Рік тому +1

    Please help me for the checkpoint, if we reach the checkpoint 2 and then game over and back to first checkpoint it will be enabled the first checkpoint. please tell me how to fix this. your help will be very grateful. Great tutorial btw, thank you!

  • @helmy0101
    @helmy0101 Рік тому +1

    Thanks for your help, nice lesson 🙂

  • @manaswinkath9301
    @manaswinkath9301 3 роки тому +3

    lots of love and support

    • @GDTitans
      @GDTitans  3 роки тому +1

      Thanks, my friend

  • @AdityaChoudhary1213
    @AdityaChoudhary1213 3 роки тому +1

    Can you make a tutorial on how to add like on Facebook to claim reaward feature (like in Temple Run 2) in our Games?? Please??

  • @malikthetalentmaker6001
    @malikthetalentmaker6001 3 роки тому

    Hey gdtitans in endless runner part 3
    When the capsule move right or left it starts vibrating
    What should I do to stop that

  • @yousufjamal3553
    @yousufjamal3553 3 роки тому +3

    Hi...
    I just subscribed... I watched your car selection menu tutorial it great. thanks...
    I added a color changing system in my game it works fine but I am having hard time to save the current color...
    How can I save the current color???
    If anyone knows please let me know thanks in advance

    • @GDTitans
      @GDTitans  3 роки тому +1

      Hi, You could use PlayerPrephs to store the current selected color

  • @menerlop3733
    @menerlop3733 Рік тому +1

    how to make it work in 3d

  • @akc5725
    @akc5725 3 роки тому

    Thanks for this tutorial but I have a problem.
    When I start game my default coin count " -100 " and it not changeable
    How can I solve it
    Please help me

  • @boxvalue
    @boxvalue Рік тому +1

    It showing index out of bounds

  • @kokokasem1547
    @kokokasem1547 Рік тому +1

    Why coin is duplicated?? U can help me pls 💗

  • @sprajapati1661
    @sprajapati1661 2 роки тому +2

    Please make tutorial on level lock or unlocked

  • @akc5725
    @akc5725 3 роки тому +2

    Coin value not update in main menu
    How can add coins in main menu
    Please reply me

    • @GDTitans
      @GDTitans  3 роки тому +1

      You could always get the numberOfCoins using PlayerPrefs.GetInt("NumberOfCoins", 0)

  • @Danny-tl1sb
    @Danny-tl1sb Рік тому +2

    Its not counting 😢😢

  • @gameperanch
    @gameperanch 2 роки тому

    when i pick the coins the coins was picked up but there is error message said that "MissingReferenceException while performed callbaclks" and this message get me to player movemen. im not understand, can someone help ? (The plyer movement script is get from this channel also)

    • @Error_70744
      @Error_70744 Рік тому

      You not given reference to callbackls in your movement script

  • @cinemalovers911
    @cinemalovers911 2 роки тому +1

    hi, great video it really helped me, just wondering what if I wanted to add more than one coin on collision?

  • @MocRidwan404
    @MocRidwan404 Рік тому

    thanks i love this chanel, i want ask for, if i take coin before dead how to coint not respown again after player respown in check poin? thanks

  • @revengerking5377
    @revengerking5377 2 роки тому

    Thank you for the video it worked for me!!!

  • @mamanullah501
    @mamanullah501 Рік тому +1

    thank you so much for this information

  • @boxvalue
    @boxvalue Рік тому +1

    Hi I have a problem

  • @m_rizaal
    @m_rizaal 2 роки тому +2

    TYSM

  • @peacesafe3087
    @peacesafe3087 3 роки тому +1

    Great content

  • @farhanbajwa8334
    @farhanbajwa8334 2 роки тому +1

    Thanks it helped a lot....

  • @cleadyvibesxd
    @cleadyvibesxd 2 роки тому +1

    it worked. thx u so much

  • @chinhhoangtc03
    @chinhhoangtc03 Рік тому +1

    tks, i love you

  • @Szogun_
    @Szogun_ Рік тому +1

    Will it work in 3d?

  • @bongglue4303
    @bongglue4303 Рік тому

    I don't understand, how can I start a new game and get the score back to 0?

    • @michaelshollaj6428
      @michaelshollaj6428 Рік тому

      clear player prefs, click at "Edit" and "Clear all playerprefs" and it resets

    • @bongglue4303
      @bongglue4303 Рік тому +1

      @@michaelshollaj6428 thank bro

  • @HuefulPhoenix
    @HuefulPhoenix 2 місяці тому

    number of coins not saving for me

  • @boxvalue
    @boxvalue Рік тому +1

    Hi I have a doubt

  • @malikthetalentmaker6001
    @malikthetalentmaker6001 3 роки тому

    السلام عليكم ورحمة الله وبركاته
    دلوقتي في كورس الendless runner الكبسوله لما بتتحرك يمين او شمال بتتهز و تعمل vibration
    اعمل ايه عشان اوقفها

    • @GDTitans
      @GDTitans  3 роки тому +1

      I think we have used vector3.Lerp to move the player.So, try to adjust the third parameter of the function to make it smoother.

    • @malikthetalentmaker6001
      @malikthetalentmaker6001 3 роки тому

      @@GDTitans sorry I don't understand

    • @malikthetalentmaker6001
      @malikthetalentmaker6001 3 роки тому

      I have a problem in endless runner
      I added the road to empty object and added a box collider and the capsule also sinked

  • @upgamingtech410
    @upgamingtech410 2 роки тому +1

    Thank you bro

  • @malithmadhawa4714
    @malithmadhawa4714 Рік тому +1

    Thank you So much !!!!!!!!!!!!!!!!

  • @arthurrodrigues5382
    @arthurrodrigues5382 Рік тому +1

    thanks a lot!

  • @bongglue4303
    @bongglue4303 Рік тому

    except that this is the value that applies to Reset Points.

  • @boxvalue
    @boxvalue Рік тому +1

    Hi

  • @boxvalue
    @boxvalue Рік тому +1

    Hello ?

  • @boxvalue
    @boxvalue Рік тому +1

    Please reply

  • @boxvalue
    @boxvalue Рік тому +1

    12

  • @KiritoVR_
    @KiritoVR_ Рік тому

    using UnityEngine;
    public class Coin : MonoBehaviour
    {
    private void OnTriggerEnter2D(Collider2D collision)
    {
    if(collision.transform.tag == "Player")
    {
    PlayerManager.numberOfCoins++;
    AudioManager.instance.Play("Coins");
    PlayerPrefs.SetInt("NumberOfCoins", PlayerManager.numberOfCoins);
    Destroy(gameObject);
    }
    }
    }

  • @boxvalue
    @boxvalue Рік тому +1

    Hi I have a problem

  • @boxvalue
    @boxvalue Рік тому +1

    It showing index out of bounds

  • @boxvalue
    @boxvalue Рік тому +1

    It showing index out of bounds

  • @boxvalue
    @boxvalue Рік тому +1

    Hi I have a problem