[PLUGIN] Canvas

From the Asset Store
[C2] [C3] support C3 build service | support Banner ads, Interstitial ads, Rewared video ads.
  • Opps, that post I quoted was wrong. Just fixed it. For your capx the correct equation would be:

    Array.At(0, 0, (int(mouse.y)*Canvas.Width + int(mouse.x))*4 + 0)

    It would be more intuitive like you said, but I was going for it being as fast as possible when I did it and haven't gotten around to a correct fix.

  • Awesome, it works perfectly now. Thanks!

  • Hey I really like your plugin and am curious if it's possible to make it so that a line will stop drawing when you hit or intersect a specified object. So let's say I had the player, an enemy, and a wall. I want to make it so that a line will be drawn between the player and the enemy, but the line will immediately end when it hits the wall. So if the wall is between the two, the line will stop drawing at the wall. Do you know of any way I can do this?

    Any help would be appreciated.

  • That's solvable completely without the canvas plugin. Search for "laser" and you should find a few examples of making a laser that stops when hitting another object.

    Here's one:

    http://www.scirra.com/forum/laser-collision-point_topic44892.html, there are others.

  • is there a how to or any documentation on how to use this?

    Sorry if im missing something <img src="smileys/smiley5.gif" border="0" align="middle" />

  • I don't have any documentation, this topic is a good place to get info on how to use it though. The plugin's actions are fairly self explanatory and there are examples in this topic that show it's use in various situations.

  • I changed a function in the plugin to be able to paste tiledbg in webGL mode.

    In canvas2D mode, the tiledbg generate a pattern, but not in webGL, so the region pasted ends up black

    here is the fix:

        //helper function
        instanceProto.draw_instances = function (instances, ctx)
        {
            for(var x in instances)
            {
                if(instances[x].visible==false && this.runtime.testOverlap(this, instances[x])== false)
                    continue;
                
                ctx.save();
                ctx.scale(this.canvas.width/this.width, this.canvas.height/this.height);
                ctx.rotate(-this.angle);
                ctx.translate(-this.bquad.tlx, -this.bquad.tly);
                ctx.globalCompositeOperation = instances[x].compositeOp;//rojo
    
                if (instances[x].type.pattern !== undefined && instances[x].type.texture_img !== undefined) {
                    instances[x].pattern = ctx.createPattern(instances[x].type.texture_img, "repeat");                
                }
    
                instances[x].draw(ctx);
                ctx.restore();
            }
        };
  • Hi, how do I make the canvas object follow the player?

  • Pinning works.

  • https://dl.dropboxusercontent.com/u/6813637/s_/index.html

    I?ve pinned the canvas objects to the player, but the light got all wrong.

    I want te canvas to aways be on the screen rendering the lights/shadows, to save processing power. ;]

    My project is here, I?m making a game for GGJ, any help would be much appreciated ^^

    https://dl.dropboxusercontent.com/u/6813637/light_test.capx

  • Found a bug, canvas paste property doesn�t work with layers that have a tilemap plugin.

  • I have a a question,

    When I try to create a circle on android with CocoonJS.

    It doesn't draw the circle.

    Is there anyway to fix this?

  • Anyone got an idea why floodfill works with project set to letterbox integer scale, but not with letterbox scale?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What with radiant gradient ?

    Canvas draw very small sircle with gradient.

  • Updated download in first post.

    Yann thanks for the fix.

    sheepy If you set webgl to off it should work. With webgl "on" the tilemap plugin doesn't do some canvas2d initiation because it doesn't need to. To fix I'd have to do the initiations from the canvas plugin which I don't want to do since it's redundant and hacky.

    Kurz fixed the gradient radial fill. I thought it was working before...

    it shouldn't make a difference but keep in mind that the floodfill won't fill on transparent pixels.

    kappie7 I haven't used cacoonjs but does drawing a circle work in the browser?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)