[PLUGIN] Canvas

From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • Hey, not sure if this has already been mentioned. But found a bug.

    Game freezes if you try to save a game state with a canvas object. You can avoid it by adding a "No Save" Behaviour to the canvas object.

  • gamepopper

    Save/load is working here. The freeze isn't a bug, it's just a slow operation to save/load the contents of the canvas. It was a feature request that has it's uses but when using large canvas' it's speed becomes impractical so the "no save" behavior is a good solution.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i need eraser for the drawing

  • Is it possible to make transformation into trapezium using that plugin ? ( something like -> subshell.com/en/subshell/blog/image-manipulation-html5-canvas102.html )

  • Just for your info, the latest Chrome version seems to misalign circles created by "Draw circle". However, it works fine if I export to Node-Webkit, so I believe this is a problem with Chrome and not your plugin. The strange gradient effect I had before is gone though.

    EDIT: The misalign is quite small, but can be seen when drawing very large circles and placing objects along the circle borders.

  • Hi, this seems like a really useful plugin!

    I'd like to know if I can use this to create procedurally generated terrain?

    Something like

    Subscribe to Construct videos now

    I managed to set it to a solid with the physics immovable property, but since paths can only be drawn onto the canvas and not with the canvas itself, is this possible?

  • Great Plugin <img src="smileys/smiley32.gif" border="0" align="middle" />

    Thanks R0J0houndR0J0houn <img src="smileys/smiley31.gif" border="0" align="middle" />

  • R0J0hound

    Forgot to mention you. (My post is above)

  • Erasing is done by pasting an object with the "destination out" blend. To erase an abitrary shape you'll have to draw to another canvas give it the "destination" out blend and paste that to the original canvas.

    stachir

    My Paster plugin allows you to draw a texture to an arbitrary quad, but it currently uses the whole texture instead of a sub-texture. But it appears doable with that.

    TwinTails

    With this plugin you can draw whatever you want, so you have the visual aspect. The collisions isn't aren't really possible with this as it's collision polygon is always just a rotated rectangle so it's not good for collisions. There are capx' around that show ways to do per pixel collisions but it's you'll need to put actual sprites over it so it can be somewhat tricky. You could try yann's Polygon plugin as it handles the drawing and collision polygons.

  • R0J0hound Thanks, I will check them out :)

  • I've discovered that the canvas.red/green/blue/alphaat expressions are very slow. I tried loading all of the image data into an array (which for a 500x750 image took like 15 minutes!) and discovered retrieving values from an array is far, far faster.

    Is there any way that those expressions could be sped up? I know I don't understand how the plugin works behind the scenes, but could the plugin store the image data in an array in addition to or instead of the method it currently uses? Or perhaps could it export the r,g,b and a values as an array to json that could be loaded by the array plugin?

    Edit: whoops, it does have to array as json. There seems to be a conflict though, as there are two asJSON expressions (one in the misc category and one in the canvas category), and the second one doesn't seem to be working.

    Edit 2: I renamed the expression in the plugin and it doesn't seem to work. The debugger says the array is holding [object Object]. Can you explain how to use it? It said something in the js about that expression being experimental - or maybe I screwed it up by renaming it. If you could get it working or explain how it works, it would be much appreciated! :)

  • Arima

    That does sound like something is broken with it. I'll try to get it working in a day or so.

  • Awesome, thanks!

  • I looked into it and for now I'll leave it as is. Both .AsJSON expressions are using the expression I added and the default one that C2 added is not accessible for now.

    For .ASJSON's use I explained it pretty well here:

    http://www.scirra.com/forum/using-pixel-colors-as-reference-for-level-layouts_topic57020_post355255.html?KW=AsJSON#355255

  • Well, I tried, but I can't get it to work. Can you tell me what I'm doing wrong? All I get returned is 0. Capx.

    Also, it would help if you added that formula to the description of the expression. Though, I think it would be a lot more intuitive if it were something like array.at(x location of pixel, y location of pixel, 0-3 representing r,g,b,a).

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