[SOLVED] How do I make text appear only once every 3 seconds (if hit)?

Uuemaich

  • Posts: 52
What I mean is, I have a door that can only be opened with a key (already got that done). If you try to open the door without the key, it pops up text in the top left screen that says you need the key and plays a sound. I can make that happen. What I can't do is get it to pop up once every 3 seconds, like if you were to keep colliding with it, without it repeating everything in every frame. Am I being clear on that?

« Last Edit: April 11, 2012, 04:06:58 pm by Uuemaich »

just4yoshi

  • Posts: 90
I assume you are using "draw text" coding... Use a boolean or number attribute that changes when the actor is on the door or not. Then place the draw text coding inside a conditional to see if that boolean is true. You can then also use time delays in addition to the collision to turn on/off the text after some time. Does that make sense?
If you need help, feel free to stop by the livestream: livestream.com/poweredbyflowers

Uuemaich

  • Posts: 52
Crap, I'm sorry. I'm doing something wrong. I'm still new so I still don't know a lot about this stuff.

It repeats the text popup sound a lot of times and then goes away.

« Last Edit: April 11, 2012, 01:22:56 pm by Uuemaich »

just4yoshi

  • Posts: 90
Place the "play text popup" in the collision code instead (where you set the collided to true). When drawing updates EVERY frame, which is why you are hearing it tons of times for 3 seconds.
If you need help, feel free to stop by the livestream: livestream.com/poweredbyflowers

Uuemaich

  • Posts: 52
Yup, that fixed it! Thank you very much. <3