Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: spook1 on Fri 23/04/2004 14:44:49

Title: RawDrawImage color changes
Post by: spook1 on Fri 23/04/2004 14:44:49
In my simulation of electrical circuits I have wires that must change color as a current flows through it.

if the current is low, the wire is normal (gold)
if the current is larger the wire must be dark-red.
if the current is further increaed the wire must turn orange
if the current further increases the wire must become white

because I have 30 elments I cannot create a view with all the different colors and use SetViewFrame. In an earlier demo I did this:
i calculated the curent through the wire, and picked the right viewframe with the current value.

Now I am looking for a scripted solution, where I can influence the color of a single sprite.
is something like this possible? Maybe using color channels or aplha channels ??
I am not familiar with this stuff.
is there anyone who can reflect on my question?

regards,
martijn
Title: Re:RawDrawImage color changes
Post by: Pumaman on Fri 23/04/2004 17:57:26
Is the wire just a line of pixels? If so, you should be able to use the RawDrawLine feature to draw it in any colour? Or if not, could you be more specific about how the wires are drawn?
Title: Re:RawDrawImage color changes
Post by: spook1 on Fri 23/04/2004 18:53:29
wires are just sprites. in former versions they were objects, now they are metallic looking bars and resistors as well as light bulbs,

cheers, martijn
Title: Re:RawDrawImage color changes
Post by: Pumaman on Fri 23/04/2004 20:32:46
Is the problem then that you have 30 different wires, all different shapes, and you don't want to have to draw 4 different graphics for each one?
Title: Re:RawDrawImage color changes
Post by: spook1 on Fri 23/04/2004 20:36:19
yes, but I guess that a simpler solution is going to be more complex ;-)

cheers
Title: Re:RawDrawImage color changes
Post by: Scorpiorus on Tue 27/04/2004 22:52:31
Hmm, that's rather problematic but you could probably RawDrawImage the sprite then use RawDrawImageTransparent() to draw some mask sprite over the current one with the desired transparency level.
Title: Re:RawDrawImage color changes
Post by: spook1 on Wed 28/04/2004 10:23:33
thanks. I'll try that next time. Now I have solved the question by drawing 40 different sprites. If interested you can download demo from: http://www.xs4all.nl/~koops/ags/spacespy_devel17.zip
Title: Re:RawDrawImage color changes
Post by: Scorpiorus on Wed 28/04/2004 15:29:09
Looks nice :)

Btw, looking at the shape of wires it could be a good idea to go with RawDrawRectangle/Line() as CJ suggested.

~Cheers