Quick Search for:  in language:    
DrawLight,function,wrote,because,wanted,light
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Xp Frames , Xp List Box And XpTextBox (updated!)
By ali s on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Light Effects

Print
Email
 
winzip icon
Submitted on: 7/18/2000 2:07:31 PM
By: Jotaf98 
Level: Intermediate
User Rating: By 25 Users
Compatibility:VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)

Users have accessed this code 9449 times.
 
(About the author)
 
     "DrawLight" is a function that I wrote because I wanted to add lightning effects to my game, if it was possible. Guess what, it is -- and here's the proof! Just have a look at that screenshot; it was made with my program, I didn't edit it with any other graphics program! :) It draws a light in any picture, but it's faster than most ways to achive this (because I used the circle's core equation instead of the Circle function). Also, you can choose the color that will be used in the effect, instead of a simple white light! As a "bonus", included is the code to draw a circle (its core equation), and something I did to remind people to vote me (because I noticed that 290 people had downloaded the Translucency effect, but only 2 had voted!) -- and automatically opens your browser and orders it to go to Planet Source-Code (it asks you if you want before doing it). And there's no need for backbuffers, as the light uses a very cool effect while loading ;) I'm working now on a way of doing this, but instead of a circle, you can use a mask! I also wanna make a variation of this for lasers (same way as the mask, but automatically draws the mask with a line).

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 8 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/18/2000 2:53:01 PM:Sean Gallardy
send me your game when u r done.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/18/2000 6:34:15 PM:Newmann
interesting... very original!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/18/2000 7:10:02 PM:Jotaf98
Thanks!
Hum, it's gonna take a while 
until it's done... but when I finish 
it, I'll make a web site for it so 
people can download it. I'll post in 
www.vb-world.cnet forum when it's 
done.
Also, I'm doing a conversion 
to DirectX7 instead of the 
SetPixel/GetPixel APIs so it's faster 
and can be used in games.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/19/2000 1:40:56 PM:kerlin
nice effect! however, radius = 150 
gives an overflow error...change long 
to int maybe? haven't looked at the 
code. will let you know what i find
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/22/2000 2:28:22 PM:Jotaf98
Ok, it's fixed now. Also, I'm uploading 
a new version right now... it lets you 
use a mask instead of a simple circle! 
It's called "Masked Light".
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/30/2000 4:43:44 AM:Simon Price
Very original? See 
http://www.planet-source-code.com/vb/scr
ipts/ShowCode.asp?lngWId=1&txtCodeId=968
4 submitted a week earlier...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/30/2000 7:12:57 PM:Jason
Hey Jotaf98! Thats really cool. I have 
one thing I'm modifing in that. I'm 
making it so the light appears where 
you clicked
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/5/2000 3:55:36 PM:Cool33
Simon is right, he made this, but 
better i might add, a week ago at 
http://www.planetsourcecode.com/vb/scrip
ts/ShowCode.asp?lngWId=1&txtCodeId;=9684
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/11/2000 12:33:06 AM:KillerQ13
Use these useful subs/functions to get 
RGB:
Function FixHex$(HexString As 
String, Length As Byte)
    If Length 
> Len(HexString) Then
        FixHex$ 
= String$(Length - Len(HexString), "0") 
& HexString
    Else
        FixHex$ 
= HexString
    End If
End 
Function
Sub GetRGB(Number As 
Long)
    Dim RGBColor As String
    RGBColor = FixHex$(Hex$(Number), 
6)
    Red = CInt("&H" & 
Mid$(RGBColor, 5, 2))
    Green = 
CInt("&H" & Mid$(RGBColor, 3, 2))
Blue = CInt("&H" & Mid$(RGBColor, 1, 
2))
End Sub
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/16/2000 6:15:06 PM:Jotaf98
Thanks, KillerQ13!
Sorry for not 
replying before, I was on holydays for 
the past 3.5 weeks...
About 
TorchCursor... I admit your sample code 
inspired me to do this, but I only did 
it because I noticed that your way was 
very well done, but was using functions 
that are slow in VB (creating circles 
in a backbuffer and then getting the 
pixels there to check the ammount of 
light). I knew that there was an 
algorythm to figure out if a pixel is 
or not in a circle, and spent an entire 
night trying to find it and (when I 
found it in one of my father's books) 
studying it (it wasn't specially done 
for VB). I also used a different 
function for getting the rgbs, I added 
the support for colors and the part 
about using translucency to draw each 
pixel was taken from my other 
submission "Translucency".
Believe 
me, I did it from scratch, and I don't 
intend to have you as an enemy just 
because of this 
miss-understood.
Friends?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/18/2000 6:28:28 PM:Jotaf98
Hum... I'm not sure if I must take that 
as a "no"...
I'll give ya some more 
time ;)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/21/2000 1:28:33 PM:Sparq
whats everyones problem? Its not a 
competition. we are all here to learn 
about VB nd help others do the same.. 
(Good Code Jotaf98)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/21/2000 6:36:36 PM:Jotaf98
Sparq is right. We're here to learn, 
not to see who has the best 
code.
Thanks, Sparq!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/27/2000 10:54:17 PM:Abdul
Jota you're a good guy.  You're posting 
your nice code in order to help other 
people.  Its not about the fame or the 
women, its about helping someone else 
out.  :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/28/2000 4:40:09 PM:Jotaf98
You too, Abdul! You could simply use 
your "media player"'s code to win some 
money (by doing your own media player 
and selling it), but no, you 
distributed the source code so anyone 
could learn with it ;)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/28/2000 4:42:08 PM:Jotaf98
And don't think I said that just 
because of what you said :p
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/16/2000 9:49:15 PM:Mitch
What exactly is the point of this? Not 
that it is bad or something, it is cool 
though.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/19/2000 7:37:06 PM:Jotaf98
Don't worry, Mitch, I'm not offended or 
anything ;)
It's so you can use 
special effects in your games or in a 
painting program.
But you should 
look for "Special Effects for BitBlt 
games" I did a while ago, it's much 
faster!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.