Drawing text when an actor is in a region

19maxk21

  • Posts: 16
Is there a way for when my actor enters a region for a text to be drawn, but go away once the actor leaves?

 I have tried:

<When drawing>
<If: Max4 is inside of region 3>
<Set current font to Waiting for>
<Draw text: What are you waiting for? Jump! at (x:900 y:800)

With this the text won't draw at all. So if someone can reposed to this with a screen shot of the code or a text with the code that would be greatly appreciated. Thank you!

P.S This is for my programming class I can't download behaviors off of Stencylforge.
\ (•◡•) /

SadiQ

  • Posts: 1795
Use the When self enters and leaves region events and put a boolean attribute in them. When he enters make the attribute true and when he exits the region change the attribute to false. In the Draw event check if your boolean is true and draw your text if it is.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

19maxk21

  • Posts: 16
I have changed the code to:

<When max enters region 3>
<Set draw text to true>

-----------------------------------------------------------------------------------------------------------------

<When drawing>
<If draw text = true>
<Set current font to Waiting for>
 <Draw text: What are you waiting for? Jump! at (x:900 y:800)>

This code isn't working still and I don't knoww what else to do.
\ (•◡•) /

SadiQ

  • Posts: 1795
X = 900 Y = 800 ????
I'm pretty sure your game should NOT have that resolution. Also, if you're using an actor behavior you need to put a ¨Switch to screen space¨ block at the top of the drawing event so that the coordinates are the ones from the scene and not the actor.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

19maxk21

  • Posts: 16
The coordinates are correct my game has a downward style. I set up the block and still nothing has happned
\ (•◡•) /

SadiQ

  • Posts: 1795
could you post a screenshot of your behavior?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

19maxk21

  • Posts: 16
\ (•◡•) /

19maxk21

  • Posts: 16
It's drawing when I enter the region but It won't go away how do I make it go away?
\ (•◡•) /

SadiQ

  • Posts: 1795
Make another event. When max leaves the reagion set Draw text to false.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.