Posted: 27th Oct 2011 8:47
what's wrong?

I need to change the color of a sprite. but I failed. why?
Posted: 27th Oct 2011 9:37
For best results make sure your sprite is grayscale to start with.
Posted: 28th Oct 2011 16:30
my sprite is colorful ,not grayscale, then how can I set the color?
once a time , I use a game sdk named CLanLib ,it's also a perfect game sdk. I can use api of Clanlib to change the color of sprite .

can the official answer this question?
Posted: 28th Oct 2011 17:50
Post the code, and attach one of your sprite graphics.

Without looking at either one it's hard to say why you "failed"

Here's an example...

+ Code Snippet
SetVirtualResolution(480,480)
planetImg = LoadImage("planet.png")
planetSpr = CreateSprite(planetImg)

do

    Sync()

    if GetPointerReleased()
        SetSpriteColor(planetSpr, random(0,255), random(0,255), random(0,255), 255)
    endif

loop


and here's the image...



Notice that the color image is shaded with the new color.
Posted: 28th Oct 2011 18:46
sorry , I took a mistake. it was not a sprite,but a text object.

agk::SetTextColor can't change the color which I need.

May I ask, is it the same for text and sprite to SetColor ?
Posted: 28th Oct 2011 20:15
The arguments for SetTextColor() are the same. But if the text is from a custom font sheet, it will only shade the colors that are not-white. If you want to replace the color in a custom font, you'll need to do that outside of AppGameKit, in a paint package.
Posted: 28th Oct 2011 22:01
I didn't use alpha.i will try it tomorrow.it's too late for me now.