- Home /
how to create a reward system when you level up
okay i have a question and answer game and i want a reward system for it, just like for example after making it to level 10 I want a pop up label that will show that after you cleared level 10 you will get a new skill something like that .
now the problem is I dont want it to appear again if i tried to repeat my level 10 so basically i just want it to pop up on the first time that i played level 10 in my QandA game i hope you get me im not good in english sory
Answer by DajBuzi · Jul 24, 2014 at 08:22 AM
Hello,
You can do some simple Database of the requirements and rewards table eq. Xml and in the Player object just read and add the id of those Rewards. I think the code will explain it better than me ;)
public List<Reward> rewards;
public class Reward {
public int m_ID;
public int m_NeededLevel;
public <SomeRewardType> m_Reward;
public Reward(){}
}
// in the player script
if(Player.rewards.Where(w => w.m_ID == ID_TO_CHECK).Length != 1)
Player.rewards.Add(rewards.Where(w => w.m_ID == ID_TO_CHECK));
So now the basic explanation. We have a list of Reward objects and when player reaches certain level we check if he has this RewardID, if he doesnt have we need to add it.
If it's not explained well just post a comment and i'll explain it deeper ;)
Regards, M.Rogalski
okay I didnt quite understand because im just a newbie in scripting anyway lets put it this way I want to show a label at the end of the level 10 game after I kill the boss i want a label that shows you unlock a new skill bla bla then after that if I'd like to play again or repeat the level 10 I dont want that message to show again because i already unlock level 11 so i dont need it telling me that i acquire a new skill again
so after i solve this problem or if ever i solve this i already see the next problem the next problem is if i already finish the level 10 and acquire the skill which is just a button if i go back to level 10 i need to have that skill because i already earned it last time i finish the level 10 anyway im not really good at english im really sorry anyway please help me :) thankyou in advance
Answer by CHPedersen · Jul 24, 2014 at 08:11 AM
In that case, you need to keep track of which awards and skills the user has already collected. I assume you have some kind of object that represents the player? In a script on that GameObject, place a list or other kind of collection that holds the awards and skills collected by that player. When level 10 is cleared, check if the skill it awards is already present in the player's collection. If so, omit popping up the notice.
Your answer
Follow this Question
Related Questions
Checkpoint system??? 3 Answers
Editor black screen. 1 Answer
How to check my Game System Requirements? 2 Answers
Accessing local system ( File Browser ) 2 Answers