Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
fire works
Author Message
zylum

Posted: Wed Feb 25, 2004 5:48 pm   Post subject: fire works

here's a fire works effect i made. enjoy

 code: setscreen ("graphics:1000;650,offscreenonly") const size := 100 const fireLength := 50 var decay := 0.98 var gravity := 1 var pixel : array 1 .. size, 1 .. 2 of real var velocity : array 1 .. size, 1 .. 2 of real var px, py : real procedure newFire (x, y, vx, maxV : real)     var ang : int     for i : 1 .. size         pixel (i, 1) := x         pixel (i, 2) := y         ang := Rand.Int (0, 360)         velocity (i, 1) := cosd (ang) * (Rand.Real * (2 * maxV) - maxV) + vx         velocity (i, 2) := sind (ang) * (Rand.Real * (2 * maxV) - maxV)     end for end newFire procedure moveFire (c : int)     for i : 1 .. size         pixel (i, 1) += velocity (i, 1)         pixel (i, 2) += velocity (i, 2)         velocity (i, 1) *= decay         velocity (i, 2) -= gravity         velocity (i, 2) *= decay         drawdot (round (pixel (i, 1)), round (pixel (i, 2)), c)     end for end moveFire procedure launch (x, ang, spd, c : int)     px := x     py := 0     var pvx, pvy : real     pvx := cosd (ang) * spd     pvy := sind (ang) * spd     loop         exit when pvy < 0         drawfillbox (0, 0, maxx, maxy, 7)         px += pvx         py += pvy         pvx *= decay         pvy -= gravity         pvy *= decay         drawfilloval (round (px), round (py), 3, 3, c)         View.Update         cls     end loop     newFire (px, py, pvx, 10)     for i : 1 .. fireLength         drawfillbox (0, 0, maxx, maxy, 7)         moveFire (c)         View.Update         cls     end for end launch loop     launch (Rand.Int (100, maxx - 100), Rand.Int (70, 110), 40, Rand.Int (0, 255)) end loop

-zylum

Paul

Posted: Wed Feb 25, 2004 5:53 pm   Post subject: (No subject)

pretty nice, though it goes a bit too fast on my computer and sometimes it doesn't explode (or is it in colors that I can't see?)
jonos

Posted: Wed Feb 25, 2004 5:55 pm   Post subject: (No subject)

yeah, i can't see it also, only a few colours every now and then.
Tony

Posted: Wed Feb 25, 2004 5:56 pm   Post subject: (No subject)

it is defenatly too fast... but if you slow it down a bit (a delay here and there) it looks nice +10Bits
Tony's programming blog. DWITE - a programming contest.
the_short1

Posted: Wed Feb 25, 2004 6:17 pm   Post subject: (No subject)

i still dont get how y9ou can make so many programs...

WAIT I KNOW>>>> I THINK I FIGURED IT OUT>>>> you make these in school dont u???? that is why ur able to make so many DAM programs every DAM week...

anyways....

fireworks ROCKS>>>>> i have a realy slow computer so animations were perfect

in 63 lines... That is NICE!

itd take me prob 300 liens and 3 hours
zylum

Posted: Wed Feb 25, 2004 6:19 pm   Post subject: (No subject)

lol, i guess that must mean my computer is a peice of crap cuz it runs at normal speeds here and yeah, i should have specified a color range that doesnt have a bunch of dark colors in it...

oh and the_short1, i dont do these at school... in fact i dont do anything in compsci... i just play games and do all the assignments on saturday cuz theyre sooo damn easy... anyways, im glad you like my proggies
jonos

Posted: Wed Feb 25, 2004 8:14 pm   Post subject: (No subject)

your class must rock!!! jk, it sucks having an easy class sometimes
Cervantes

Posted: Thu Feb 26, 2004 6:14 pm   Post subject: (No subject)

If you look close enough (unless its actually a black ball) you can see the particles flying off.

Great job zylum!

Andy

Posted: Thu Feb 26, 2004 9:34 pm   Post subject: (No subject)

ever heard of delay?
the_short1

Posted: Thu Feb 26, 2004 9:46 pm   Post subject: (No subject)

one thing... your program kinda sucks with 800x600 res... maybe have a option for both taht and 1000+w/e the other number is
WhatAmIDoing

Posted: Mon Mar 01, 2004 12:18 pm   Post subject: (No subject)

Thats pretty cool all though if you add a delay of 50 after the View.update it really works a lot better
Hotaru

Posted: Wed Mar 03, 2004 6:54 pm   Post subject: (No subject)

your program worked very well~but there is only one suggestion~the colour is plain~so perhaps you can make the fireworks multi-colored~
Tallguy

Posted: Wed Apr 23, 2008 12:54 pm   Post subject: RE:fire works

cool, but to agree with everyone, do add delays, and have more then one firecracker go off @ the same time
Mackie

Posted: Wed Apr 23, 2008 2:42 pm   Post subject: RE:fire works

How did you even manage to find this? It's four years old I hope you realize.
Tallguy

Posted: Thu Apr 24, 2008 7:03 am   Post subject: RE:fire works

i searched it, i need fireworks for my final, so i wanted to see wat others had made
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 2  [ 24 Posts ]
Goto page 1, 2  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: