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.

Code Snippets / [DBP] 2D Lightning Function

Author
Message
lower logic
18
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 16th Aug 2007 22:14
I got bored so I made a lightning function:


To compile you will need D3DFunc installed.
Ankillito
17
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Litigious California
Posted: 18th Aug 2007 09:22 Edited at: 18th Aug 2007 09:28
Lower Logic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You're Back!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Woot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

file>save as>LL's awesome code>lightning

definite keeper.

http://forum.thegamecreators.com/xt/xt_apollo_pic.php?i=1234759
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 21st Aug 2007 04:09 Edited at: 21st Aug 2007 04:09
Wow that was really cool. Tell me. How are you so good at coding?!

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Aug 2007 21:11
do they always go from the corners through the center?

Your signature has been erased by a mod because it was rubbish.
lower logic
18
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 27th Aug 2007 07:05
Thanks.

"do they always go from the corners through the center?"

Yeah, in the example these four function calls make lightning bolts from each corner to the mouse's position, but the function can be called to make bolts between any 2 points:
Mortus
17
Years of Service
User Offline
Joined: 14th Dec 2006
Location: Illinois
Posted: 5th Sep 2007 17:32
he i translated to non-d3d
i have d3d so i dont know if it works someone give it a try?

calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 31st Oct 2007 23:21
Very nice lightning effect!

It works - they flash up for a split-second and then disappear (actually like lightning). Also it seems to only render in horizontal strips of 100px high.

When removing the sync-related commands I get a better result, albiet rather strange.

That fractal_line function could come in very useful, especially for energy-like effects (like plasma-balls). It would look better if it didn't have a definite edge, though.

Urrgghh! A self-calling function! those are the sorts of things I don't recommend.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 2nd Nov 2007 16:03
Hehe.. Try this

The amount is 50 and because of that its slow but awesome looking!
Just change the amount value to make diffrent looking effects



[center]

Click for details!
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 2nd Nov 2007 16:39 Edited at: 2nd Nov 2007 16:40
New one!
Three diffrent looking thunders in circle shape

Pic:


Code:


[center]

Click for details!

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-22 13:26:34
Your offset time is: 2024-11-22 13:26:34