R0J0hound's Forum Posts

  • A brute force way would be to just have a variable for the total time in the plugin space. aka here:

    /////////////////////////////////////
    	// Behavior type class
    	behaviorProto.Type = function(behavior, objtype)
    	{
    		this.behavior = behavior;
    		this.objtype = objtype;
    		this.runtime = behavior.runtime;
    		if (typeof this.behavior.totalTimeUsed == "undefined")
    			this.behavior.totalTimeUsed = 0;
    	};[/code:23ivohi0]
    
    Then you could just get the current time at the start of a function and right before it returns get the time again and add the difference to the total time.  You get the current high res time with performance.now().  The kahanTime gives you C2's "time" expression and is dt adjusted so it's not what you want.
    
    [url=https://developer.mozilla.org/en-US/docs/Web/API/Performance/now]https://developer.mozilla.org/en-US/doc ... rmance/now[/url]
    
    Here's a possible implementation:
    [code:23ivohi0]behinstProto.profileBegin = function ()
    {
    	this.ProfileStartTime = performance.now();
    };
    
    behinstProto.profileEnd = function ()
    {
    	this.behavior.totalTimeUsed += this.ProfileStartTime - performance.now();
    };
    
    behinstProto.tick = function ()
    {
    	this.profileBegin();
    	
    	if (!this.enabled)
    	{
    		this.profileEnd();
    		return;
    	}
    	// do stuff
    	this.profileEnd();
    };[/code:23ivohi0]
     
    Now adding lots of floating point numbers together will give rounding errors over time.  You can do this instead of a simple add to circumvent that if desired:
    [url=https://en.wikipedia.org/wiki/Kahan_summation_algorithm]https://en.wikipedia.org/wiki/Kahan_summation_algorithm[/url]
  • The core part is being able to slice a polygon by a line into two polygons. This can be done by calculating the intersection between the line and the edges, as well as finding which side of the line a point is.

    Here's one possible psuedcode of the algorithm to do it:

    for each edge clockwise
       if edge.point0 is on left side of line
          add point to poly1
       else
          add point to poly2
       if edge intersects line
          add intersection to poly1
          add intersection to poly2[/code:3d7po4e6]
    
    Next we have the issue of drawing an arbitrary polygon and changing the collision polygon.  Vanilla C2 plugins won't help here.  I don't use it but the third party polygon plugin by yann probably could work since it both lets you draw arbitrary polygons at runtime and it makes it's collision polygon match.
    
    The rough psuedocode for that could be:
    [code:3d7po4e6]get the list of edges of a polygon
    try to slice the polygon in two with a line
    destroy the old polygon and create two new polygons from the sliced polygons[/code:3d7po4e6]
    
    Also on a side note you'll want to set the new polygons' velocities the same as the old polygon otherwise the pieces will go at a complete stop after slicing.
    
    At least that's a general idea how to do it.  There might be some issues that need to be ironed out, such as I don't know how well the polygon plugin works with the physics behavior.
  • It depends on the error. My guess is the two plugins are incompatible. Paster was made as a replacement to Canvas and I didn't intend for them to be used together.

    Actually thinking about it, pasting a paster object to a Canvas object won't ever work when webgl is on. It's a legacy issue and can happen when pasting various other plugins too.

  • Zebbi

    It's simple enough to test and see. Loading images is done per instance with tiledbackground instead as with per object type with sprites. To animate you probably would want to just create a bunch of instances, load a different image per one, and cycle which one is visible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try instead something like 300 to 30 to see the difference.

    Lerp(300,30, t) will go counter clockwise.

    Anglelerp(300,30,t) will go clockwise. It basically will pick the shortest direction.

  • I thought third party plugins were allowed in the arcade for a while now. I found this oldish post about it:

  • The topic with the effect probably has the best info how to do it. Unfortunately it's very specific so it's hard to do. Personally as the one who made the effect I don't think it's easy enough to use to do anything exact, rather it's more for a mode7 like look.

  • Does the example capx in my post not work? I guess I'll have to have another look at it when I get the chance.

    Edit:

    Example seems to work fine.

  • You can make a layer a layer not rotate with the layout from the layer's properties. Off the top of my head it's done by setting the parallax to 0,0.

  • To be clear it is possible without third party plugins if no fullscreen scaling is used. Also it may be possible to do by fiddling with some css of the canvas and such, but i didn't spend much time exploring that idea.

  • The catch is with any fullscreen scaling the image will still be the size of the screen.

    If you use the paster or canvas object you can do this instead:

    https://www.dropbox.com/s/mdb3cy5pwt7eb ... .capx?dl=0

    1. A snapshot is done

    2. The image is loaded into a Sprite that covers the view.

    3. That Sprite is pasted to a paster object that is positioned to the spot you want and with the image resolution you want.

    4. The paster.imgUrl expression will give a base64 URL just like the canvassnapshot expression to save the result.

  • Using families is a way to pick separate instances at the same time. It's pretty much the only way to connect two instances of the same object with a joint.

  • What does userfolder & testfolder evaluate to? Does userfolder end with a slash?

  • Odin

    I had a quick look at your capx but I don't have time to figure out what's different from the other example I made. Sorry I can't be more help.

  • Of the 134mb most of it is the chromium web browser. If anything I imagine it will only get bigger with newer updates.

    Last I looked it's not trivial to build it from the source code to tinker with ways it can be reduced. I'm not sure it'd be worth scirra's time to cut features from it because someone would miss it, not to mention that from update to update the way to remove a feature may change. What we have is an html5 game enigine that allows any browser feature to be used, so nothing short of a full browser will support it all.

    It could be possible to make a smaller runtime with a graphics library and a small JavaScript enigine and then reinventing the wheel for any other feature needed. There is probably no interest in doing this officially. Unofficially it could be done but the issue of someone to make it and support it is a problem, as well as that could be considered curcumventing the personal licience exe export.