R0J0hound's Forum Posts

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

  • Looks like a nice thing to have. But what I really miss is the ctrl+c and ctrl+v on events like in old Construct Classic.

    How do you mean? They are working for me in C2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of atan2(y,x) use angle(0,0,X,y).

  • It probably will have the same performance.

  • I'd say don't generate the whole level at once. Generate what's immediately on screen and then progressively generate the rest of it. The idea is to make it so the impact on the framerate is negligible. You could also generate the next level when the current level is done loading. There's probable a lot of ways to go about it.

    Actually doing parallel coding will require using javascript and even then it's not so simple.

    • Post link icon

    The mouse wheel button is the middle mouse button.