R0J0hound's Forum Posts

  • You can do that with the paster or canvas plugins. Just make either the size of the screen and use their actions to draw the polygon. If you're using webgl then paster will be faster, also with either they take up a texture usually their same size.

    If you make a plugin you can do it without the texture as well.

  • Instead of checking if it's a symbol you don't want, just check if it's a symbol you want. Do it under the "on text changed" condition, and the length can be truncated there too.

    global text allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    
    +-------------------------------------------+
    | textbox: on text changed                  |
    +-------------------------------------------+
        local text filtered = ""
        +---------------------------------------+
        | system: repeat 8 times                | system: add mid(TextBox.Text,loopindex,1) to filtered
        |System: find(allowed,                  |
        |  mid(TextBox.Text,loopindex,1)) <> -1 |
        +---------------------------------------+
        +---------------------------------------+
        |                                       | textbox: set text to filtered
        +---------------------------------------+[/code:20x8j9rq]
  • Maybe the bullet behavior and the rotate behavior with negative acceleration?

    An all event route could also look like this:

    Global number dist=0

    Global number ang=0

    Every tick

    --- add 100*dt to dist

    --- add 180*dt to ang

    --- Sprite: set position to (100,100)

    --- Sprite: move dist pixels at angle ang

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • there have been other topics for that. The equations for the motion of a falling projectile is this:

    y1=y0+vy*t+0.5*gravity*t^2

    x1=X0+vx*t

    X0,y0 is the start position

    X1,y1 is the end position

    Vx,Vy is the velocity

    t is time

    If you pick a time and then solve those equations for vx and vy that would do it.

    I think it's referred to elsewhere as predictive aiming. You could also Google kinematics for more tutorials about the equations used.

  • It's basically done with a bunch of springs. Hook's law is the equation to use to calculate spring force. Then it's just a matter of tuning the constants. So the math isn't that bad at all.

    Searching for jelly gives these two:

    The first one is more applicable I suppose. It's just a grid of point connected by a mesh of springs. Making it interact with other objects is where the most work is needed and there are many ways to handle it.

  • The general way to use values from a particular instance is to pick it with a condition the footsteps1.x will be the X of the one that's picked.

    You could also not use picking and use footsteps1(5).x to get the X of the fifth instance. But picking is probably easier to read.

    You can use an array of you like, I mean if it's easier to understand. It probably isn't needed though since the object list can be thought of as an array too. Reading the manual sections on how events work could be a useful reference.

    Generally you need global variables or global objects to pass information between layouts. The persist behavior saves an objects state so it's the same if you leave a layout and come back. If the events are overwriting the state then you'd need to rework the logic of the event sheet.

    The overall logic of your game should be pretty much the same as if you made it in any other language. My solutions are probably too terse to be useful since the logic is obscured away so it's not obvious to others.

  • When you say layer I think you mean layout. You could try the presistance behavior on the footsteps perhaps. It lets them keep their state even when you switch layouts.

    Also kind of unrelated but

    For each Sprite ordered by Sprite.iid ascending

    Is identical to

    For each Sprite

    The expression you use with the "for each ordered" is used to sort the instances before looping over them. To filter out some instances from being picked you need to use another condition. Maybe the pick by comparison condition.

  • Using the pick nth instance with Sprite.count-1 should do it.

  • Usually I just replace all the " in the js with ' which works well. To actually use " in js it looks much uglier and makes it harder to find typos.

    For example the take this js:

    var name = "bob";

    To use in c2 this usually is what I do:

    "var name ='bob';"

    But if you want to still use " it looks like this:

    "var name=""bob"";"

  • The manual explains the conditional operator pretty well here:

    https://www.scirra.com/manual/78/expressions

    But yeah, it's like a simple if then else.

    If X=2

    Then set y to 4

    Else set y to 5

    Can be written instead as

    Set y to X=2?4:5

  • 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.