Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by davidflynn2 · Aug 14, 2013 at 03:57 PM · c#level-design

Leveling system

I'm looking for a tutorial on creating a leveling system with a level progress bar like you would find in World of warcraft. I want it so the bar fills as you gain exp and when you level the bar emptys and fills all over again for the next level reqireing the new exp. Is there any tutorial or anything any one know of for this. I created one but I cant get the exp bar to to fill fill up then change for the next level. I am only look like 10 level to start with.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DannyB · Aug 14, 2013 at 04:18 PM 0
Share

Thats a broad question. Perhaps it would help others provide an answer if you can describe where you have difficulties.

avatar image clunk47 · Aug 14, 2013 at 04:47 PM 1
Share

Well here is a basic example of a progress bar with an exp amount, a maxExp amount. This test lets you add exp by pressing the '+' on the keypad. In this example, I have exp starting at zero, maxExp set to 1000, and a Texture that fills in the background (gui box) as you progress. No matter what you set your maxExp to, it will never overfill the background box, since the simple formula here keeps the fill based on the percentage of the width of the box. I've attached an example of what kind of texture you could use, just a 32x32 green fill. Assign this texture in the inspector. The higher you set your maxExp, the slower this will fill.

 using UnityEngine;
 using System.Collections;
 
 public class Example : $$anonymous$$onoBehaviour
 {
     public Texture2D bar;
     Rect bgRect;
     Rect barRect;
     Rect labelRect;
     int exp = 0;
     public int maxExp = 1000;
     
     void Awake()
     {
         bgRect = new Rect(32, 32, 512, 24);
         barRect = new Rect(34, 34, 0, 20);
         labelRect = new Rect(32, 64, 128, 24);
     }    
     
     void Update()
     {
         if(exp > 0)
             barRect.width = exp * bgRect.width / maxExp;
         
         //TEST
         if(exp < maxExp)
         {
             if(Input.Get$$anonymous$$ey ($$anonymous$$eyCode.$$anonymous$$eypadPlus))
                 exp += 10;
         }
     }
     void OnGUI()
     {
         GUI.Box (bgRect, GUIContent.none);    
         GUI.DrawTexture(barRect, bar);
         GUI.Label(labelRect, exp.ToString());
     }
 }


Image

g.png (158 B)

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Yokimato · Aug 14, 2013 at 04:23 PM

Creating a progress bar that fills is extremely easy with NGui. They have a free version, I suggest taking a look there.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How should I make this type of text level editor? C# 1 Answer

Making a bubble level (not a game but work tool) 1 Answer

An OS design issue: File types associated with their appropriate programs 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges