R0J0hound's Forum Posts

  • Ok I had a look and to me it looks like the audio analyser in webaudio isn't meant to read the entire song, only what's currently playing as a real time analysis. Maybe instead you could utilize the following to take a sound file and decode it into the raw pcm data and analyse that somehow:

    https://developer.mozilla.org/en-US/doc ... eAudioData

    Here's a the result:

    https://dl.dropboxusercontent.com/u/542 ... eform.capx

  • SoldjahBoy

    Here's an example. I did the outline by scaling the object instead of moving eight copies which seems to work better with round or square objects.

    https://dl.dropboxusercontent.com/u/542 ... tline.capx

    The picking is unavoidable. You could store a list of uid's of the objects in each group in an array so you could loop over the array and pick by uid. That would be faster than normal picking with a high number of instances. Utilizing pick nth instance and iid is another option instead of uid but things can change when instances are destroyed.

    This can also be manipulated a lot depending on what you want to do. If only one outline is shown at a time you can have only one paster object.

    I also fiddled with the idea of changing the group based on the object's z order and came up with this:

    https://dl.dropboxusercontent.com/u/542 ... line2.capx

    Your idea of the groups being always the same should work too. You just need to zsort the groups.

    As far as performance, you probably can get a boost by just using the fx like in the first example, still the rendering perfomance will be a bit slower or at least it should be similar if each group was on it's own layer.

  • Webgl and my pc don't get along so I don't mess with shaders anymore and I won't be fixing this. It's probably the shader that's to blame and how I wrote it since issues have come up since I first made it.

    A possible workaround for the opacity would be put the object on it's own layer and change the layer opacity instead of the object opacity.

    The outline around the border could be from sampling garbage values outside of the quad. Maybe clamping the uv coordinants inside the shader could help to keep them inside the box.

  • My next guess is that's how far ahead the song is loaded if it's being streamed. I'll try to look into it more tomorrow when I get access to construct again.

  • 22500 is a common sample rate for sounds so maybe that has something to do with it. It could be just how far ahead the plugin looks. You could try searching for the number in the audio plugin's source code to see if it's ever used.

    On another note in webaudio the analyzer effect seems to mainly just be used to get the waveform in sections. I'm not sure if it can get the entire song at once. Some googling about the webaudio analyzer hasn't yielding anything yet except for it being used to show the sound as it plays.

  • SoldjahBoy

    Webgl doesn't get along with my PC so I'm not really working on shaders anymore.

    The shader works by taking the source texture's alpha and making a colored silhouette. Then that is duplicated eight times and each one is moved in a different direction. The first to the right, the second down-right, the third down, and so on...

    To make it outline multiple objects as if they were one object you need to Make them one image first. That's what layers do, so a layer per multi-part object could be one solution?

    You could instead use the paster object. Basically by drawing each group of objects to their own paster instance and applying the outline effect to that.

    I've become rusty with making shaders and since I can't test them I can't come up with ways to change the blend mode or opacity of them. However the outline can be done with the paster object without webgl and the end result is an the paster object will have the outline as a texture so you can draw it any way you'd like.

    I'm not able to make a capx right now but here's how to do it:

    First create a paster object and rename it outline. Make sure it's a little bigger than the object you want to draw and make it's origin centered.

    For simplicity we'll outline a Sprite. The events would look like this:

    Global number linewidth=4

    Every tick

    --- outline: clear to rgba(0,0,0,0)

    --- outline: set quad color to rgba(0,0,0,1)

    Repeat 8 times

    --- outline: set position to Sprite

    --- outline: move linewidth pixels at loopindex*45 degrees

    --- outline: paste Sprite

    Every tick

    --- outline: set position to Sprite

    --- Sprite: set blend mode to destination-out

    --- outline: paste Sprite

    --- Sprite: set blend mode to normal

    --- outline: draw quad (0,0, 640,0, 640,480, 0,480) with blend mode destination-in

    That should do it. The quad color is whatever color you want to use and when the quad is drawn on the paster with the destination-in blend it colors the outline. I was a tad lazy with the corners of the quad, it just needs to cover the outline object so you could use the bbox expressions instead. Anyways barring anything I overlooked that should give you a way to do a outline with the paster object. I'll try to make up a more re-useable example later.

  • Like this?

    key 1 is down

    key 2 is down

    trigger once

    --- play sound

  • 21 isn't a key code for anything. Lookup "javascript keycode" on google to get a list of keycodes for the different key. Like this one:

    http://www.javascripter.net/faq/keycodes.htm

    Numpad 1's key code looks to be 97 if numlock is on.

  • Okay, use this instead:

    str(x)&str(y)

    The "&" operator is both string concentration and logical and. If both values are numbers then logical and is used otherwise string concentration is used.

  • There isn't really a need for an array at all. And really events aren't much different from regular code.

    https://dl.dropboxusercontent.com/u/542 ... cking.capx

  • set z to int(x&y)

  • You can do it without the canvas plugin. The ring is made by creating sprites in a circle. An the masking is done by using blend modes. The shrink/grow of the circles is done by changing the size:

    https://dl.dropboxusercontent.com/u/542 ... _load.capx

  • I tried my hand at making a minimal event ticktacktoe before looking at whiteclaws' example.

    I got 6 (or 4 if you don't count variables) events and I think this is near bare minimum*.

    https://dl.dropboxusercontent.com/u/542 ... event.capx

    You can increase readability by bumping it up to 8 (3 variables and 5 events):

    https://dl.dropboxusercontent.com/u/542 ... dable.capx

    *A one event ticktacktoe is possible by using the conditional (?:) operator:

    https://dl.dropboxusercontent.com/u/542 ... event.capx

    Well it's actually one event and two variables.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The blend modes are something that will work even without webgl. So without webgl that's the limit what can be done. Once webgl is supported absolutely everywhere subtractive could just as well be a blend mode I'd imagine.