Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / change color on text and make text stay for X seconds on the screan

Author
Message
Alahadi
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location: Sweden
Posted: 15th Feb 2010 22:19
Hello there.. again!

How do I change the color of text I write out on the screan with for example dpText?

Also I need a code that makes a text stays for X seconds becouse this wont work for me:



I want it to write out the text for 2,5 seconds but all it does is writing out the text after 2,5 seconds for 0,1 seconds.
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 15th Feb 2010 23:28
Your text isn't showing up till after 2.5 sec has passed is because you havnt used dbSync till after the 2.5 sec wait, you could add a dbSync right after you use your dbText command to update the screen befor waiting or you could setup a timer and display your text based on that so you don't freeze up your game loop for the 2.5 secs.

the simplest timer system you could use is with the dbTimer() command. when you click you could do something like text_timer = dbTimer() then you can check each loop how much time has passed to decide if you still need to display the text, you would do that something like this... if(dbTimer()-text_timer < 2500){ dbText(hello) } ...this is just a simple example of what you can do to display something for X amount of time. you can search the forms for dbTimer() for some better examples, just wanted to point you in the right direction.

as for the text color use dbInk() to set text color / basic 2d drawing colors.

also i recomend reading the documentation and becoming familar with all the commands, it really helps to know what tools you have at your disposal.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 15th Feb 2010 23:33


may help you out.

www.touchofdeathproductions.com
Alahadi
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location: Sweden
Posted: 16th Feb 2010 00:09 Edited at: 16th Feb 2010 00:18
Thanks alot that dbSync was what I needed, and yeah it freezes everything for 2,5 secs so I have to use that timer Marsh0 posted.

Yeah I'm new in this so I always sit in the documention trying to solve things by my self but sometimes I can't get it to work.

EDIT:

dbInk changes ALL my dbText to that current color! I just want to change what I write on one dbText!
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 16th Feb 2010 01:23
So simply change the color back after that line.

www.touchofdeathproductions.com
Alahadi
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location: Sweden
Posted: 16th Feb 2010 02:01
I can just choose diffrent blue colors with this?..
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 16th Feb 2010 02:52
whenever i use dbInk() to change a color i usually change it back to white afterwards so that everything else will be "normal"... dbInk(dbRGB(255, 255, 255), dbRGB(0, 0, 0)); ...i don't know if your using the dbRGB() command when you use dbInk() but it makes it alot easier to pin-point the color you want.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 16th Feb 2010 08:49
keep in mind that dbInk slows down the program

Alahadi
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location: Sweden
Posted: 16th Feb 2010 13:31
@Hassan
I dont want it to be that much slowed down but I'll still need diffrent colors on my texts in the program. Is there a better way than dbInk?

@Pilz~
I will try this as soon as I can, I will tell how it worked later. Thanks
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 16th Feb 2010 13:50
the only way is making text by using sprites, look @ dark invaders text example, it would have been really cool if dbInk worked faster
well i tried using sprites, but got alot of problems with positioning characters on the main image, so didnt focus on it =p

Login to post a reply

Server time is: 2024-11-20 03:31:29
Your offset time is: 2024-11-20 03:31:29