UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: stef on August 31, 2006, 11:13:51 AM

Title: Fireworks
Post by: stef on August 31, 2006, 11:13:51 AM
Hi!

The code below (in attachment) is a simple fireworkscode

It's more a test of particle-behaviour, but works.
The most breaking factor is the fading of a image of screen-size (800x600).I think it will better work with PBFX

controls:

leftclick: monocolor

rightclick: multicolor
F1: slow color cycles
F2: fast color cycles

spacekey: toggles starfield

EDIT: the version "fireworks2" (see next posts) is much faster
Title: Re: Fireworks
Post by: stef on August 31, 2006, 03:25:39 PM
Hi again!

You can made the code faster with "blitimage" (gives similar result)

change in loop:

delete line:

FadeImage fireim,90


instead of line: 

DrawImage fireim,0,0,1

paste:

BlitImage fireim,0,0,1,128,RGB(10,10,10),0,0   


Greetings
stef
Title: Re: Fireworks
Post by: kevin on August 31, 2006, 04:37:28 PM

   You can also use the InkModes commands to perform the fading of the particle buffer by setting it to alpha subtract and drawing a box over the image.  This then allows the particle buffer to be transparently drawn over the screen then. So the backdrop is visible

   The attached uses that method. Should give the same result as BlitImage.
Title: Re: Fireworks
Post by: stef on August 31, 2006, 04:53:04 PM
Hi

You method is incredible fast. Absolutlely cool :)

Greetings
stef

Title: Re: Fireworks
Post by: Ian Price on September 01, 2006, 03:02:58 PM
Very nice :)
Title: Re: Fireworks
Post by: stef on September 02, 2006, 05:32:17 PM
Hi!
Thx! :)

There is a small bug in "fireworks2" (spacekey is not working)
my stars were also a little bit jerkily (in fullscreen-mode)

This is a corrected version