A Script that will open doors with an amount of coin
Hi I'm making a low poly game and I would want to know how would I make it as in each level there is amount of coins or jewels to open a door and there's a number count on top. So like you need 100 coins or jewels to open this door to go on to the next level. What would I need or how would I create that script or if someone could create It I will credit you ty byeeee
Answer by nathanlink169 · Jun 27, 2017 at 10:22 PM
Just a note, that people won't be able to provide a full script with that little amount of detail:
Are you using Unity2D or Unity3D?
How are you storing your money?
Do you have a door script already?
Providing as much detail as possible will help us answer your questions.
Unity 3D And Idk you could store money and I don't have a door script... >~<
You will need to put some work in yourself - from what I can tell you're a beginner, and that's okay! We all started somewhere, myself included. That's what these forums are for.
I'll attach a partially created currency script below. What I recommend is following the tutorial found here, and your challenge is to finish the script that I'm attaching here. By the time you get there, you should be able to finish more advanced tutorials and learn how to create a door script.
using UnityEngine;
public class $$anonymous$$oney : $$anonymous$$onoBehaviour
{
// Called on creation of the object
void Start()
{
m_Current$$anonymous$$oney = 0.0f;
}
// Called every frame
void Update()
{
// Empty
}
public void Add$$anonymous$$oney(float in_moneyToAdd)
{
// TODO: Add in_moneyToAdd to m_Current$$anonymous$$oney
}
public void Remove$$anonymous$$oney(float in_moneyToRemove)
{
// TODO: Remove in_moneyToRemove from m_Current$$anonymous$$oney
}
public float Get$$anonymous$$oney()
{
// TODO: Return m_Current$$anonymous$$oney
}
private float m_Current$$anonymous$$oney;
}
Thank and I will watch the video thank you again :)
Your answer
Follow this Question
Related Questions
Open Door Animation Problem 0 Answers
How to make an enter building button in a 2D game? 0 Answers
how to make a door close for ever after a player pass through it 0 Answers
How do I not set a trigger to happen? 1 Answer
How to get "on trigger enter"( or exit) to only react to a specific tag 1 Answer