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.
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
I want it like that too, have you solve it?
I need same help too I am not alone
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
I love you, you helped me with like 5 problems in one video! please continue making videos, you're great at it
Thanks 😊 I really appreciate it
Hi how do you reset the coin when you restart the game? because every game does that.
Same... Plz tell me if u found the ans....
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
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
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
Did u fix it?
So how can I display the total of coins that have been earned in a different scene. Like the main menu.
Use playerprefs.GetInt to get the number of coins 🪙
Please tell how to add sound when we pick up a coin
In the next tutorial
@@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
@@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
perfect and eazy tutorial THX bro
Thank you for tutorial ✌ i learned new methods thank you so much 😊
No worries
great tutorial you always help me so much :)
Thanks 😊
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!
Thanks for your help, nice lesson 🙂
No worries!
lots of love and support
Thanks, my friend
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??
Hey gdtitans in endless runner part 3
When the capsule move right or left it starts vibrating
What should I do to stop that
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
Hi, You could use PlayerPrephs to store the current selected color
how to make it work in 3d
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
It showing index out of bounds
Why coin is duplicated?? U can help me pls 💗
Please make tutorial on level lock or unlocked
Coin value not update in main menu
How can add coins in main menu
Please reply me
You could always get the numberOfCoins using PlayerPrefs.GetInt("NumberOfCoins", 0)
Its not counting 😢😢
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)
You not given reference to callbackls in your movement script
hi, great video it really helped me, just wondering what if I wanted to add more than one coin on collision?
Yes you can!
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
Thank you for the video it worked for me!!!
thank you so much for this information
No worries
@@GDTitans 😍
Hi I have a problem
TYSM
Great content
Thanks, 😀
Thanks it helped a lot....
Glad it helped
it worked. thx u so much
No worries
tks, i love you
Will it work in 3d?
Yep
I don't understand, how can I start a new game and get the score back to 0?
clear player prefs, click at "Edit" and "Clear all playerprefs" and it resets
@@michaelshollaj6428 thank bro
number of coins not saving for me
Hi I have a doubt
السلام عليكم ورحمة الله وبركاته
دلوقتي في كورس الendless runner الكبسوله لما بتتحرك يمين او شمال بتتهز و تعمل vibration
اعمل ايه عشان اوقفها
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.
@@GDTitans sorry I don't understand
I have a problem in endless runner
I added the road to empty object and added a box collider and the capsule also sinked
Thank you bro
No problem 😊
Thank you So much !!!!!!!!!!!!!!!!
No problem
thanks a lot!
No worries!
except that this is the value that applies to Reset Points.
Hi
Hello ?
Please reply
12
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);
}
}
}
Hi I have a problem
It showing index out of bounds
It showing index out of bounds
Hi I have a problem