Note that there are some explanatory texts on larger screens.

plurals
  1. POcocos2d - how to extract rgb from color
    primarykey
    data
    text
    <p>i'm making the final part of my game where it tells you what your score is. I wanted to make it flash, dynamic and animated, so i want the score to sort of total up, which i plan to do by making the text displayed by the score closer to the actual score in each draw event, until it reaches the total score.</p> <p>However, i want the digits of the score to flash as they increment, and then fade. I plan to do this by extracting the last digit from the score that was displayed one step away, and then comparing it to the last digit from the score that is currently displayed. Then, if they are different, i will set the color of the last digit from white to orange. This will happen for every digit.</p> <p>But then i want the digits to fade back down to white again, so what i need help with (i've looked everywhere and can't find answer) is i need to get the color of every letter, and then merge it into white. but i don't know how to get the red, green and blue components. here's what i've got so far:</p> <pre><code>-(BOOL) colourCount:(CCLabelBMFont*)label currentNo:(int)cNo targetNo:(int)tNo { CCArray *characters = [label children]; //-------The code for making certain letters orange will go here---------- //below makes the color of every letter more white for (int i=0; i++; i&lt;[characters count]) { [(CCSprite *)[characters objectAtIndex:[characters count]-i] setColor: [self mergeFont: [(CCSprite *)[characters objectAtIndex:[characters count]] color] ] ]; } } </code></pre> <p>and then i need a function called mergeFont that takes an input of a color, makes it more white, and then returns that color. I'm not even sure what a color is stored as though - is it an int?</p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload