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.

AppGameKit Classic Chat / SetSpriteColor, only parts of the sprite?

Author
Message
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 26th Jun 2017 08:04
Can I use SetSpriteColor to only color certain parts of my sprite? I have a drop shadow in it that I want to keep the color of while changing the color of other parts of the sprite.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 26th Jun 2017 08:36
Maybe with Memblocks looping through each pixel and only changing certain pixels in the loop i.e. the bottom ones or looping through and changing the colour of every pixel except for the black and transparent ones.

It seems like it might be a lot easier to maybe remove the shadow from the sprite though and add it to another sprite on it's own and have it constrained/fixed to the main sprite so that it follows it when it moves around the screen. If the main sprite is animated meaning the shadow is animated too then just make sure that both sprites have animation applied and are in sync.
tmu
8
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 26th Jun 2017 15:35
I would agree with Kevin. Remove shadow from the main sprite and make a 2nd sprite for the shadow. Set shadow depth below the main sprite and move it along. You might be able to even reuse your main sprite image if you just set the shadow sprite colors to all black and play with its alpha channel.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jun 2017 13:27
Different layers of sprites. That's how I did it in my Barbarian game; character stayed the same but could tint the clothing color for different players.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Markus
Valued Member
21
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Jun 2017 14:27
without creating sprites drawsprite command can be useful.

AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 27th Jun 2017 18:32
Phaelax wrote: "Different layers of sprites. That's how I did it in my Barbarian game; character stayed the same but could tint the clothing color for different players."

Each layer is it's own sprite and you just position them on top of each other?

baxslash
Valued Member
Bronze Codemaster
18
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jun 2017 08:45
You could also use a mapping image which could be controlled via a simple shader. So the shader looks at the secondary image applied to the sprite and if it finds a specific colour it shades that pixel.
Using AppGameKit V2 Tier 1
fubarpk
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jul 2017 00:58
Phaelax I think has the easiest and possibly the fastest solution

I was going to add could use a shader but Baxslash has already suggested it
fubar

Login to post a reply

Server time is: 2025-06-01 23:29:25
Your offset time is: 2025-06-01 23:29:25