How to set font color for a word with find()?

0 favourites
  • 4 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • I would like to learn how to set font color for a word using find(src, text)?

  • bump

  • Here is a starting point:

    http://dl.dropbox.com/u/5426011/examples14/word_highlight.capx

    It finds the position of a word and then breaks the text into 3 separate instances (text prior to word, word, and text after). You can then change to color of the word independent of the rest of the text.

    In it's current state it only works with one text line, and finds only one word to highlight.

    Here's a list of what could be done to enhance the technique in roughly increasing difficulty:

    * Make it work with multiple text objects.

    * Make it highlight all occurrences of a word in a line.

    * Make it able to highlight different words to different colors.

    * Make it work with multi-line text.

    I would take a look at the plugins to see if there are any that allow for displaying formatted html text as that would simplify it by replacing words like "green" with say "[_COLOR=#00ff00_]green[_/COLOR_]".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is a starting point:

    http://dl.dropbox.com/u/5426011/examples14/word_highlight.capx

    It finds the position of a word and then breaks the text into 3 separate instances (text prior to word, word, and text after). You can then change to color of the word independent of the rest of the text.

    In it's current state it only works with one text line, and finds only one word to highlight.

    Here's a list of what could be done to enhance the technique in roughly increasing difficulty:

    * Make it work with multiple text objects.

    * Make it highlight all occurrences of a word in a line.

    * Make it able to highlight different words to different colors.

    * Make it work with multi-line text.

    I would take a look at the plugins to see if there are any that allow for displaying formatted html text as that would simplify it by replacing words like "green" with say "[_COLOR=#00ff00_]green[_/COLOR_]".

    R0J0hound delivers the best reply, thanks a lot. I tought Pode's HTML plugin there are html format can easily setup a color for a word, i'm not sure it can be dynamically done. I will try a test.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)