SPRITE STRUCTURE CONTROLLED BY A KEY

Diana's picture

Hi everybody. I´m new at QC and I´m looking for a way to enable 6 sprites and macros with a key but in an secuencial way.

How can I create a "next" and "previows" key to enable them?

I attach an example.

Thanks a lot for your time.

Diana.

PreviewAttachmentSize
structure for sprites.qtz8.54 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

franz's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

use a counter patch

gtoledo3's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

There's a patch called "Demultiplexer". By using the Settings panel, once you've created an instance of it, you can change the type to "Boolean", and enable the "Reset Value". Make the Input value True, and the Reset value False.

Then, by using the Counter as franz suggests, you can connect the output result of the Counter to the Destination Index of the Demultiplexer, and the Destinations to the objects you wish to trigger on and off. When the Destination Index # is active, it will give a True value, with all other outputs False.

Diana's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

Thanks both!! I´ve it :)

PreviewAttachmentSize
structure for sprites finish.qtz9.17 KB

bytezen's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

Thanks for posting your solution. It's accelerating my ascent up the qc learning curve.

-polygon's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

Also if you want you can connect the enable disable sprite signal (from the demultiplexer) to a Smooth patch and then to the alpha in the RGB patch which is connected to the sprites you are switching

this will instantly enable the sprite with 0 alpha then fade it in, and when you switch it off it will fade out and disable itself when it reaches 0 alpha

Just if you want to avoid this flash which looks like a workaround :D

PreviewAttachmentSize
counterfade.qtz34.29 KB

-polygon's picture
Re: SPRITE STRUCTURE CONTROLLED BY A KEY

You can also avoid the counter if you need the sprites to enable using the number keys (for example keys 1,2,3)

by using the freeboard patch which publishes the key value (so 1 for key 1 , 2 for key 2 etc different than the keyboard patch which signals 1 or 0(which can also be multiplied by the key value)) and using it with a math expression patch with max(key1,key2,key3) and a sample and hold patch behind it, plugged in to the demultiplexer

sorry if this is a messy answer lol

PreviewAttachmentSize
counterfade-123.qtz34.41 KB