playMaker

Author Topic: Creating score with the new UI  (Read 3179 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Creating score with the new UI
« on: January 02, 2015, 03:04:21 PM »
Hi!

Can someone give me an example how to create score using the new UI? I don't understand why this should be so much better than the old GUI which is very easy to do it.

I need a step-by-step help with this. I know how to create a button and text, etc.
The only thing I need help with is the UI Score and update it with points every time I pick up something.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Creating score with the new UI
« Reply #1 on: January 03, 2015, 01:48:26 PM »
Create a text ui (create-ui-text).  This will also create a canvas.  Al ui must be on a canvas.

Create a game object called 'score manager'.
     Have a event called 'add1toplayerscore'.  After go to another state with the add int, convert to string and get ugii text.  On the FSM you will need to make the event global (check box).  the variable score can be an INT but you also need another STRING.  That way you increment the INT but display the STRING.

So you create a collision box (like on a cannon ball) and when it hits something, you 'send event' to the 'add1to player score'.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Creating score with the new UI
« Reply #2 on: January 03, 2015, 01:56:34 PM »
So here is a bullet that gets shot.  It is a prefab so on the other message I had to store that prefab as a variable.  That is the GO (game object).

So when the bullet hit something (the player tag as this is an enemy bullet), it store the collider and goes to the next state.

The next state sends and event to the score manager which increments the enemy score.  Then the bullet destroys itself.

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Creating score with the new UI
« Reply #3 on: January 03, 2015, 05:32:04 PM »
Hi!
Thanks for the answer. I don't have the NGUI Actions. It costs 10 dollars. I thought it was included in the "uGuiProxy package for Playmaker.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Creating score with the new UI
« Reply #4 on: January 03, 2015, 10:00:18 PM »
don't use NGUI.  Just use the standard unity ui.

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Creating score with the new UI
« Reply #5 on: January 04, 2015, 12:16:54 AM »
Ok!

But I don't have UGUI Set Text Action you use in the example.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Creating score with the new UI
« Reply #6 on: January 04, 2015, 12:35:40 AM »
I found it and got it to work. :)

Thank you so much for the help. :D
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no