Representation of Experiencie Gained over the Enemy

Hi to everyone,
I’m trying to do something to show the experience gained over the enemy, something like “2exp”, but I don’t know how to do it.
The only thing I got is a text message over the enemy but that stays there forever and is really insipid, i mean, is completely static, i want to do something something rising over the enemy until it fade.

If it’s not a annoyance, can anyone write a function to do that? (Better in java if possible)

And if it’s possible i’m going to do another little question. I know how touch works on unity, and when I create a button I create it in two parts, graphical and detection. Graphical is simply the position, and detection is a pice of code in Update() that compares the finger position with the graphic position to detect over wich button is the finger, but as I use a Vector2() to especify the position, it only detects the begining of the button as the button and it’s really dificult to push it. Anyone can tell me how to made it work?

Thank you a lot! Abel.

For the text there are a few approaches. If you are going to potentially have multiple ones, where a character could have more than one showing at a time, you could create the toast (an element that pops up) as separate object and and instantiate them when needed. (or pool them, but that is more advanced).

If it is just one, you can have it as part of the character and then just have it animate in and out as needed. You can use the animation curves in Unity, but I typically just use a tween class. There are a few in the asset store, all are good. I prefer HOTween, but for this iTween or LeanTween will do the trick perfectly as well. (you could write your own, but all those packages are solid).

You would just tween it from invisible (alpha 0) to visible (alpha 1) and probably a going up a little bit or whatever you want it to look like. Delay a bit, then fade and drop back down.

For the touch part, if you aren’t actually using multi fingers or other related stuff, you can get away with OnMouseDown for button functionality. Unity will register that a touch on mobile platforms.

Otherwise you will want take your hit Vector2 and do a raycast from the camera to see if it touches your gameobject. (make sure it has a collider on it). Any part of the gameobject covered by the collider that is on screen and not blocked by another object will register the touch.

Thank you very much, i’m going to try it now and see if works okey!

The touch part, now that I see my first post, was no clear enought. I’m using unity touch clases because I need multitouch on my game. I’m doing a game for Android in 2D that needs at least two points of touch, one for the joystick (I’m using the prefab joysitck that cames in Standar Assets (Mobile), and onther for the attack, magic attack and jump buttons.

Thank you, Abel!