[PLUGIN] Canvas

2 favourites
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • Ah... didn't see your post at the end of page 2... this is basically the same as Yann's modified version of your plugin :)

    I'll just use the effect setting then :)

  • hey this is great, i managed to cut the holes in the canvas, but how did you managed the character falling into it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ah i get it, you get the color at canvas and move the sprite if its a certain color

  • Correct. Just like the way the old lemmings games worked :)

  • Ize

    I can't run your second test. On Chrome I get white screen, on IE9 the loading freezes at 90%. First test works fine on Chrome, on IE9 it's same as with second.

  • First one is normal canvas2d, on the second i enabled webgl... might have todo with that.

    You can get my Lemmings example in .capx form here:

    scirra.com/forum/my-examples_topic45860.html

    Try if that works you... you can also try disabling webgl in the project settings so it only uses canvas2d and then it should work 100%

  • For saving, there is always the the canvas.toDataURL() method

  • Rojo

    Would it be possible to be able to paste a Layer ?

    I'd like that for 2 reasons :

    1/ As there's no families yet, you have to list a bunch of sprite to paste by event. If we could paste a layer you would just need to group your pastable/not pastable sprite by layers

    2/ If you have some zSorting, you would need to know each time what is in front of what and do the pasting in the proper sequence. If you paste the layer it should be automatic.

    Also, I'm looking for a way to implement the drawGL function in the plugin but I can only generate black texture v__v (my game is a bit slow without webGL)

    Anyway, I don't think I thanked you for this plugin so thanks (:

  • Yann: can you use the .toDataURL() to do what you want with layers ?

    With that function, you can retrieve what's on C2's canvas, get it inside a png, and paste the png inside R0j0's canvas...

  • hu? really? I would prefer a simple Paste Layer, I'm looking into that right now. Just have to retreive the list of what is on the layer and paste them in order.

    If I can't do that I'll try your way (:

    By the way I made canvas work with webGL and also added some other hotspot option (the whole 9 basic ones)

    I'll look into this paste layer thingy and PM the plugin to r0j0 so he can make a proper new release if what I did look ok to him (:

  • New update on first post.

    New R4:

    [Fix] Now works with WebGL. (thanks to Yann)

    [Add] Additional hotspot locations top-right,top, etc...(thanks to Yann)

    [Add] Paste Layer action(thanks to Yann)

    [Change] Paste object/layer action now only paste visible objects.

  • Just a heads up.

    Since setting color has to be a string you cant use variables, or loops like "rgb(loopindex("r"),loopindex("g"), loopindex("B"))"

    The quotes within quotes makes C2's error checking kick in.

    You can use double quotes, and it will be accepted, since its a string, but the browser cant make heads or tails of it. IE loopindex(""x"").

    What does work is concatenating everything into one string like:

    "rgb("&loopindex("n")&","&loopindex("n")&","&loopindex("n")&")"

    Or

    "rgb("&array.at(loopindex("x"),loopindex("y))&","&&array.at(loopindex("x"),loopindex("y))&","&&array.at(loopindex("x"),loopindex("y))&")""

    and if you want to use values above 255, or below 0.. which you cant use

    "rgb("&clamp(array.at(loopindex("x"),loopindex("y),0,255)&","&clamp(array.at(loopindex("x"),loopindex("y),0,255)&","&clamp(array.at(loopindex("x"),loopindex("y),0,255)&")""

    Yeah, maybe I'll go learn to use hsl now.

  • Was just looking at some of the html5 attributes, and was wondering would it be possible to use a texture in paths?

    Also any thoughts on adding the shadow attributes?

  • the plugin doesn't work for me. i want to paste a sprite into the canvas, like in the demo capx. but this one just shows one wheel without any canvas, not like the exported html.

    could you please add a working capx?

  • Don't know if you have access to control the alpha channel and the color texture separately, but if you do I have some features to suggest.

    I thought about a "Clear to Transparent" action with transparency control. This would fill the alpha with black with the respective opacity making the entire canvas a little more transparent. If this name doesn't sound so intuitive it could maybe be called something like "fill alpha" or "clear alpha".

    This would allow to easily create trail effects without the need to spawn multiple canvases or objects, also saving some resources. With an every tick "Paste object to canvas" followed by a "Clear Canvas to 10% transparent", you could simply create trail effects.

    Another idea is to allow drawing to the alpha directly. This would be a powerful feature opening a lot of possibilities. Instead of creating new actions for this, a dropdown parameter "Destination" could be added to all the "Draw" actions with the options of "Texture", "Alpha" or "Both" (being "Both" the default). This respectively would allow to choose to draw to the color texture only, the alpha only, or to both (like it currently is). The color parameters could be automatically converted to grayscale when "Alpha" is selected.

    And lastly, just for consistency, I would suggest either making the "Draw Circle" action to draw it filled like the "Draw Box", or make the "Draw Box" draw it outlined like the "Draw Circle" (although I prefer the first option).

    I think that's all I have to contribute for now. Keep up the great work!

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