How to make text appear above an actor?

Omniso

  • Posts: 192
how do you get text to appear above an actor? The issue is I have an anchored actor that serves as a custom HUD that displays certain stats. When in combat, clicking on an enemy ship will display its stats as well on that HUD but won't actually be visible.  Everything works fine. . .  except for that the text displayed when an enemy is clicked is invisible or under the player HUD actor. The HUD is being created and player stats are being drawn by a scene behavior but the additional stats are being drawn from an enemy actor which isn't visible for some reason.  How do I fix this?

EDIT: The text from the scene behavior is visible but the text from the actor behavior isn't visible on the HUD

« Last Edit: October 15, 2016, 09:58:38 pm by Omniso »

Eriko

  • Posts: 162
Hi. I gotta tell you: I know how it feels when something fairly simple won't work. Now, with that said,


1. Stencyl now comes with a feature that allows us to assign in which layer we want to display text. You might want to check that out.


2. Maybe there is a bug.


3. An alternative might be "labels". I know it sounds outdated, but they works.
 
4. Check the coding for the clicking. Maybe there is a boolean left on "false" for some reason(believe me, it can be very frustrating).


I hope that can help somehow.




BMJ

  • Posts: 278
I have been having a similar issue and I have submitted a bug report to the Stencyl team just now.

Having said that, I am pretty certain your math is not correct in the actor behavior drawing (when drawing from an actor behavior, the default is actor space, so [camera X] - [X of Self] would produce strange results. Imagine your Camera X is 1000 and your X of Self = 300 (in screen coordinates, since this is a HUD actor). The result would be that the text is drawn 700 pixels away from the 0,0 of your actor.)  Have you tried using the "switch to actor space" block (to be certain of your origin) and using 0, 0 as the coordinates for drawing? (This would result (in theory) in the text being draw in the upper left corner of your actor's image).

As I said, I've submitted a bug report, because I also have been wrestling with this lately and have found no way to get drawing text from an actor behavior to work properly, and as you said - it works from a scene behavior (but it draws behind any HUD actor.)

EDIT: Just to be clear, this only seems to be a problem for HUD actors.

« Last Edit: October 16, 2016, 10:45:02 am by BMJ »

Nikkita31

  • Posts: 131
Hello.

I encountered the same problem before. I was able to solve this by drawing the texts on scenes instead of actors. I hope this one helps.

regards,
Nikki

Omniso

  • Posts: 192
1. Setting layers did not fix the issue. The text was still invisible under the HUD

2. Maybe.

3. I'm sorry but labels really isn't an option for me

4. No boolean is left on false, believe me the code does work.

+BMJ My math is correct. I know this because with this math the text created by the enemy actor is displayed on the top left corner of the screen at all times.  If I incremented the Y position any higher than 110 and 125 the stats of the enemy actor would be displayed below  the HUD (visible but not where I want it) so I know it's working. Havn't tried "Switch to actor space" block but I will in a moment. EDIT: I used 0, 0 as the origin and the "Switch to actor space" block and still the same results.

+Nikkita31 That's the problem though, the HP/Name/Other stats of an enemy actor are entitled to it alone. In order for this mechanic to work properly these have to be drawn from the enemy actor instead of the scene.

letmethink

  • *
  • Posts: 2545
Does the 'set drawing to scene layer' block not work in this circumstance?
~Letmethink

Omniso

  • Posts: 192
That was the first block I tried before making this post. Same result.