R0J0hound's Forum Posts

  • This topic may be useful

    You may also be able to do it with the light object and blend modes.

    Make a layer not transparent and put the light object on it.

    Give the light object the destination out blend. Then add a Sprite for the view cone to that layer and give it the destination in blend.

    I could be confusing the blends but that's the general idea.

  • Modifying c2runtime.js isn't really feasible. When the project is exported the JavaScript of the runtime and plugins are minified so they aren't readable, but on top of that the events or logic of the capx is probably in data.js and that is only readable by the JavaScript portion. In short it's not worth the effort to reverse engineer the export to be able to make changes.

    The most I've seen someone do is change a setting after an export.

  • You could, but the trouble here is it switches between how C2's renderer is set up and a different set up that has a z-buffer. In a nutshell each object will be 3d but come out as 2d sprites that you'd have to sort in the same way as you currently do in C2.

    But yeah it should be possible. You'll probably want to utilize some 3d library to simplify the amount of rendering code.

  • Here is an experiment of using the browser object to run javascript in a few interesting ways. You can do anything you can do with a plugin with this, but it's all done in C2 which makes it quicker to test changes.

    First off it's used to load js files and interact with C2's runtime. This isn't minifier friendly, but it should be possible to wrap it in a plugin so it will be.

    The main thing done in this capx is to change the rendering of one instance of an object in an interesting way.

    With webgl off: some arbitrary canvas drawing is done.

    With webgl on: a 3d cube is drawn inline with the rest of the other objects (as opposed to only on the very top or bottom).

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

    /examples35/js_test2.capx

    Maybe this will be interesting/useful to someone.

  • frozenen

    The light's blend mode seems to be most of the issue. I can't come up with an easy fix but you probably can get it to work by being specific as possible.

    When it's single screen the light layer is black and you erase the lights from it.

    When it's split screen you need to replicate the layer with another paster to get it to work. As it is now it's drawing the light as if it's on the same layer.

  • In a nutshell the paster object only has limited support for effects as I recall. It works fine if the object uses only one effect, but it ignores alpha and blendmodes apparently. Also multiple effects are not chained correctly. There are also issues with effects relying on screen position. It uses a heavily modified version of the code C2's renderer uses to apply effects. The goal was to make results identical but there were a number of things that needed to be reworked to make it work, and I lost interest before working out solutions to many of them. In the end I don't use webgl since it performs worse on my PC than with it disabled so I haven't had any reason to persue it further. Not to mention it is a very time consuming thing to work on, and unfortunately I don't have that kind of time anymore.

    The blend modes are built in and don't use effects. A solution could be to only do one step at a time and use multiple paster objects to store each step:

    paster1: paste sprite //sprite has effect1

    paster2: paste paster1 //paster1 has blend mode

    paster3: paste paster2.

    Another idea is maybe just using the canvas snapshot system action?

  • Ah, it's probably an issue with pasting with effects and blend modes then. I won't be fixing any part of the plugin that involves applying effects any time soon.

    A possible solution could be to paste the object to another paster first, then apply a blendmode to that.

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

  • Try Construct 3

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

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