R0J0hound's Forum Posts

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

  • Try Construct 3

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

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

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

  • turn off gravity by setting it to 0.

  • You could try doing it with the physics behavior, since you wan the object to have momentum. Just apply forces to move the ball around.

  • There is nothing in place to help with that. With the physics behavior the shapes need to be defined in the editor before the game is run. You could use the canvas or paster plugins to draw the object though.

    One idea could be to build the shapes out of a bunch of simpler objects and join them together with joints, but that does have some issues. Namely objects joined together with joints behave a bit spongy.

    A better solution is to work with the physics engine at a lower level using javascript, although you can't really do this along with the physics behavior. More on this in a moment.

    The basic flow of your game would be to:

    1. when you draw the shape a list of points is made.

    2. Those points make up a polygon. This needs to be converted to a list of triangles or at least convex polygons. This is mainly for the physics engines which generally don't work with concave polygons.

    3. find the center of mass by averaging the point locations.

    4. create the physics object with that shape.

    That may vary depending on what a given physics engine does for you.

    Here's one possible example of using javascript to access a physics engine instead of using the behavior:

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

    /5426011/examples34/jsPhysics.capx

    On another note you did say simple objects. You probably could use some gesture recognition to see if the object is close to a circle, square or triangle. Then add a sprite with that shape and size and orient it to approximately match the area drawn. The gesture recognition is something a plugin may be able to help you with, or maybe even some other capx on the forum.