R0J0hound's Forum Posts

  • If you use "box2d web" instead of "box2d asm.js" you can use the browser object to run:

    "Box2D.Common.b2Settings.b2_velocityThreshold = 1.0;"

    and set it to whatever value you want. The asm.js version seems to not have that variable. This won't work after minifying.

  • You could just edit in in place if it's something just you would use. If you want to change it per project the best thing would be to add an action to the plugin. That would give the easiest access to the setting.

    I guess it may be possible to change the setting with some JavaScript run with the browser object. That can be hard though, mainly to track down a code path to access it. It would also not work if you minified your project.

  • Typically there is only a runtime and edittime js. The physics behavior Is special case. One is just a JavaScript port of box2d and one is one compiled with asm.js. It's bigger but will run near native c++ performance. You can select between the two in the project properties.

    If you were to copy the behavior just pick either file to be your runtime.

  • If you're using ajax to get the file you could try this:

    http://stackoverflow.com/questions/2235 ... -f5-reload

    aka: setRequestHeader('Cache-Control', 'no-cache') before requesting the file. Also the second idea in that link is interesting. I don't have anything to test this with.

  • I don't have all those plugins so I can't open it. I made a test and everything seems to be working fine with the paster object from my end.

    I added a sprite and a paster object to the layout. Then made an event:

    start of layout:

    --- paster: clear to (0,0,0,100)

    --- paster: paste sprite

    --- browser: invoke download of paster.imageUrl

    That worked fine. Even when changing the sprite's blend mode to any of the others. The only exception is xor, which doesn't work with webgl, but that is C2 wide.

  • As far as I know pasting stuff with blend modes to either canvas or paster works fine. With paster some of the blend modes have slightly different behavior with webgl on but this has to do with webgl and not the plugin.

    You'll need to give examples of how it doesn't work since blend modes worked fine for both plugins all the times I've used them.

  • What is this useful for? Just curious. The manual mentions the relevant ones, whereas much of the rest are helper functions used by the runtime that isn't useful to a plugin dev.

  • Aphrodite's way works too. Basically there are three ways:

    1. Pass by value by building a string. This one as Ashley says can be an issue if the string contains " characters. You probably can come up with a creative solution if need be.

    2. Utilize the function object. Make the JavaScript call a c2 function that in turn returns the value of something. This wouldn't have the " issue.

    3. Find where the actual variable is in c2's runtime code and access it there. This will only work with minification if done inside a plugin. Also it is the most complex to do.

  • You refer to it like this:

    "prompt('title goes here.',"& myLocalVar&")"

    The basic idea is you can't directly access an event sheet variable from JavaScript, but you can combine its value in the text.

  • It'll be a while before I can look at it. Maybe next Sunday at the earliest.

  • In your game wait till the particles are "warmed up" then set a textbox to particles.asjson. You can then copy the text from it. Next close your game, go to the event sheet and add the action "load from json" and paste the copied text and put quotes around it. Now when you run the layout the particles will already be running.

    The text you paste may need a little tweaking. Namely replace the " with '. Then you can put " at the start and end.

  • All the paster and canvas give you is an image. There collision shape is fixed as a box.

    Physics will have to done in another way. The example above is one, making a bunch of different sized sprites beforehand is another I guess.

    In short, basically anything can be done. In this case it's not something that's not made simple with existing things in C2 so instead you have to use some inginuity to get it working.

  • The only plugin to do custom webgl like that is this one:

    It doesn't replace the shaders, but it does change the vertex data.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • C2 doesn't prevent it, it just wasn't designed to do it. This would have to be done by either modifying C2's runtime (which I'd leave to Ashley if it was ever to be added) or run custom webgl from a plugin's drawgl function.

    To do it it would basically just require you to set a uniform after an effect was made active. There isn't a spot you can do that in conjunction with C2's effect rendering code.

    That said you can do anything in the drawgl function in plugins, you just need to restore any webgl state changes before exiting the function. The idea is you'd bypass c2's system for using effects and doing it manually.

  • From the web browser debug console you can type cr_getC2Runtime() to get a snapshot of the entire c2 runtime that you can browse. It doesn't have the object names so it's a bit trickier, but if you know the uid of the object you can get it with cr_getC2Runtime().objectsByUid[2] where 2 is the uid. It's probably more of a novelty that you can access everything that way if you locate where to look, in practice it's better to use C2's debugger.