Parabolic Maddness

Started by
22 comments, last by EDI 21 years, 5 months ago
light_x,y is point of light

target_x,y is target point

dir_x = target_x - light_x
dir_y = target_y - light_y

dir_x,y is now the vector from the light point to the target point. Now normalize it:

len = sqrt( dir_x*dir_x + dir_y*dir_y )

dir_x /= len
dir_y /= len

(of course check for division by 0 before doing this)
Advertisement
thanks,

ok things have worked out great,
ive implemented the light into my engine

and things are working perfectly,

here are some screen shots

they are from the game im making,
it's entirely 2D

this screen shot uses the GDI adaptor
*my graphics engine uses a common API adaption interface
to make it graphics api indipendant*


before any lighting *day scene*:
http://rubberneck.net/raymond/tid_0131.jpg

light locked to character with wide beam
http://rubberneck.net/raymond/tid_015.jpg

light locked to character with narrow beam
http://rubberneck.net/raymond/tid_016.jpg

thank you very much Yann L

Raymond Jacobs,
Profesional Web Applications Developer,
Weekend Game Developer,
www.EtherealDarkness.com

[edited by - EDI on October 23, 2002 8:53:59 AM]

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

You''re welcome.

Very nice pics, BTW.
thanks=)

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

This topic is closed to new replies.

Advertisement