R0J0hound's Forum Posts

  • Physical accuracy isn't really important in this case since you're going for a look, and a bunch of springs will be enough to do that here.

    Wikipedia has a good overview of the methods.

    https://en.wikipedia.org/wiki/Soft_body_dynamics

  • Just a guess, but i'd assume that setting is for making the other file format. However you can check if the ogg is re-encoded by saving the capx as a folder and comparing the size of the ogg you imported and the one in your project folder.

  • One way to do it is to check if every point on the one object is overlapping an instance of a second object. Think loops with a couple "overlapping point" conditions. This can be slow checking every frame or even every time an object is placed on top so if you use an array to store the polygon area you can progressively do it by smaller area checks. Keep in mind this is based on collision polygons so something visually covered may not calculate as being so.

    https://www.dropbox.com/s/bitbk9af918us ... .capx?dl=1

    /examples33/overlap_pixels_poly.capx

  • If it helps all mirroring does is make the width negative. So when mirrored at 0 degrees the sprite will appear to face left. Of course this is something you could test and see.

  • The object being drawn is the source and what's already been drawn is the destination. If you use the "force own texture" on a layer then for objects on that layer the destination is only what's been drawn on the layer.

    The paster/canvas plugins can be used to isolate what's being drawn where in cases where layers with their own texture isn't enough.

  • Using tilemaps sounds inefficient for that. Here's the way to do it using a layer and four sprites with the destination out blend.

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

  • [quote:3q64psj0]...without having to make C2 loop through all the instances.

    The pick nth instance doesn't loop through all the instances, it just picks the instance directly.

  • Prominent

    Here's the working script for the latest nw.js:

    "var win=nw.Window.get(); win.on('close', function() {c2_callFunction('nw.js close',[]); win.close(true);});"

    I had forgot to make it actually close after the trigger. You can change 'nw.js close' to any function name you want to use.

  • There really isn't a way to do it manually. Well a very hacky way could be to have a square Sprite and a triangle Sprite. Then you take the for points and figure out how to make it out of rectangles and triangles with the requirement that the triangles can't be scaled up.

    Another could be to have four scaled sprite with the destination out blend to erase parts of a colored Sprite.

    But really those plugins add features that aren't doable with vanilla c2.

  • Here's a reference on how to do it with JavaScript:

    https://github.com/nwjs/nw.js/wiki/window

    My next question that I'll have investigate later is if you can access nw.js with JavaScript with the browser plugin.

    If that's possible we can execute a few lines of js at the start of the game that will call a c2 function when the window closes.

    Edit:

    I'll assume for a moment that you can access nw.js with the browser object.

    You'll need the function and browser objects, then execute this js at the start of the layout:

    "var gui = require('nw.gui');

    var win = gui.Window.get();

    win.on('close', function() {

    c2_callFunction('nw.js close',[]);

    });"

    Then add this event anywhere. I should be called before the window is closed.

    On function "nw.js close"

    --- do something

    If the js causes an error so it doesn't work I'll have to look into it further when I get a chance.

  • 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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.