[PLUGIN] Paster

  • Is there any way to detect if an image fails to load via url?

  • newt

    Probably, the loading is done with an ajax request and it can know when it fails. I'm not updating plugins now though.

  • Understood.

    The nice thing about this plug is that not only can you load a texture, but use its texture somewhere else.

    Which coincidentally will probably work as a work around.

    Thanks.

  • Hi, please, I do not quite understand how I should paste an object onto the canvas.

    I'm using "paste object" but only a box appears and I have to choose the object, it does not allow me to choose which frame and which animation of that object I want to paste on the canvas and also does not allow me to choose the X and Y coordinate where I want to paste the Object inside the canvas.

    My question is: how do I select the X and Y coordinate and the animation frame I want to paste onto the canvas?

    ---------------------------

    Please correct me if I am wrong, is this the procedure to paste an object that does not exist ?:

    1 - Create the object and place it in the coodenadas you want.

    2 - Choose your animation and the frame you want to paste.

    3 - Use "paste object"

    4 - Destroy the object.

  • the Mnk

    The paste action will draw the selected object onto the canvas wherever it overlaps the paster object.

    So just position the object any way you want before pasting it.

  • the Mnk

    The paste action will draw the selected object onto the canvas wherever it overlaps the paster object.

    So just position the object any way you want before pasting it.

    Okay, I understand, it's like a stamp.

    Thank you!.

  • Hi R0J0hound

    you Demo: Example capx

    https://dl.dropboxusercontent.com/u/5426011/plugins/pasterEx/index.html

    File has expired

    Cannot download

    Requesting updates

    Thank you

  • I'm curious. Would a layout sized Paster object use a lot of memory and use up a lot of fill rate? I was going to try to use it to paste footprints across the map wherever characters go. Would it be better than spawning a lot of footprint sprites across the map? And would it be possible fade those over time?

    Thanks.

  • tunepunk

    If the current device has enough video ram and it supports a texture of that size then it will work. Fill rate is irrelevant to me. Fading the footprints could be done by pasting a low opacity with the destination out blend. It won't fully fade out due to rounding though. An effect could be made to do the fade better, however I have no idea if one exists.

  • What I did was size the paster object to the layout dimensions, and then resize the viewport to the layout dimensions, paste the tilemaps in the order I want them, then resize the viewport back to the normal size. You have to resize the viewport because tilemaps won't draw tiles that are offscreen. If you have a lot of tilemaps it may take a second or two to paste them all, which means you'll need to use something to cover up your level while it is sized to the layout so that you can't see everything. I used a separate layer with black background and I make is visible during that pasting, and then invisible when the viewport goes back to normal. I also delete the tilemaps as they get pasted.

    How exactly did you go about this? I couldn't find any actions for resizing the viewport. Only scaling for layer and layout. I'm curious to try a similar approach, to see if there's any performance benefits.

  • How exactly did you go about this? I couldn't find any actions for resizing the viewport. Only scaling for layer and layout. I'm curious to try a similar approach, to see if there's any performance benefits.

    I believe it is Set Canvas Size, under the browser object. The first action in that object.

    Another way you can do it, although it might be slower, is to pan across the layout and paste as you go- so you could find how many times the width of the viewport fits into the layoutwidth and reposition that many times pasting each time.. etc..

    But I think it is quicker to resize the viewport since it requires less pasting.. The difficulty is hiding the view as you do that.

    You might have to limit the resized viewport anyways if your layout is super huge, and reposition like a few times to cover everything (there is a max texture size of the paste/canvas?) idk.. I remember having some issue with super large layouts, and using a viewport of like 25% the size of the layout helped.

    edit: btw, if you use multiple tilemaps that have reasonable complexity to them, you will get a huge speed increase by flattening it this way. Of course you lose the layering of all the tilemaps, but you could still have a few pasted layers and sort it all out. Definitely improves speed if you're using a lot of tiles.

  • Tanks for the info Prominent . I'm just curious, if there's anything else about this method using paster, that is better than just using a single large layout sized sprite? (if you create the whole map in one sprite, that is)? I guess the main reason behind this is to reduce draw calls?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tunepunk , I guess it would depend on your workflow and how you're designing your maps, and the interactions with the map. In my case, I was designing a game that had the map procedural generated, so the terrain would always be different when the game was run. It would create the terrain in various tilemaps, and then I would paste those using the paster plugin, and remove the tilemaps afterwards.

    For some reason the tilemap becomes very inefficient when you want to actually make an interesting map that has a lot of variation, and also use multiple tilemap layers. Actually the reason isn't a mystery- it actually is due to it having to change draw calls whenever the tile changes to a different type of tile.

    So if you need a way to make adjustments to the map in the editor or maybe need to refer to the tiles or objects in order to setup other objects at the start, etc, then this becomes more useful.

  • Hello, a question, is it possible to paste a tile of a tilemap object on the canvas ?.

    For example, I have a 64x64 image and I want to use paster to paste an area of that image that occupies 16x16, I do not want to paste the complete 64x64 image.

    Paster does not allow me to choose the area of origin that will be pasted in the canvas, paster simply paste objects or URI images but it does not allow to define the size of the source area (in this case it will be 16x16 of a 64x64 image) that will be pasted in the Canvas.

    I would like to define:

    X1 (x origin)

    Y1 (y origin)

    X2 (width)

    Y2 (high)

    So I would do, for example:

    X1 = 16

    Y1 = 16

    X2 = 32

    Y2 = 32

    That is a 16x16 tile contained in the tileset of the tilemap object image, I select the area (which in this case would be a 16x16 tile) that I want to paste onto the canvas.

    I hope you understand what I mean because English is not my mother tongue.

  • the Mnk

    I'm not really making examples as of late, but two ways come to mind:

    1.

    you could make a second paster and set that to the size you want, then position that over the part of the tilemap you want, paste the tilemap, then paste that paster to the other one.

    2.

    another idea is to utilize the draw quad actions. You define the four corners, and the uv's of them of the texture of some object. More math to figure out beforehand is needed for this, and it would only work if you can grab the tilemap's texture, I don't think you can though.

    Hopefully that can give some idea's. I haven't verified any of it so I may be off here and there.

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