How do I paste an image over another image?

0 favourites
  • 4 posts
  • Hi everyone,

    I am making a jigsaw puzzle game. I want to paste image over puzzle pieces

    Any idea how to do it?

  • Familiarize yourself with blend modes and force own texture on layer. This will be used to 'cut' your pieces out of the image.

    The straightforward way would be to have a layer for each puzzle piece, which consists of the cutout with blend mode over the image. We want to avoid using so many layers, so instead use a single layer to temporarily define each piece, and paste it to an instance of a canvas object.

    If I were to attempt it I would probably approach it over time, pasting one canvas instance/puzzle piece per tick and moving it out of the way, while cycling through animation frames of the various cutouts in place and moving the main image accordingly.

  • Familiarize yourself with blend modes and force own texture on layer. This will be used to 'cut' your pieces out of the image.

    The straightforward way would be to have a layer for each puzzle piece, which consists of the cutout with blend mode over the image. We want to avoid using so many layers, so instead use a single layer to temporarily define each piece, and paste it to an instance of a canvas object.

    If I were to attempt it I would probably approach it over time, pasting one canvas instance/puzzle piece per tick and moving it out of the way, while cycling through animation frames of the various cutouts in place and moving the main image accordingly.

    Perfect reply. I was thinking the same. Actually there are 36 pieces hence I was wondering if 36 layers may have effect on performance hence I asked the question

    Super thanks for the reply 👍

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would avoid layers simply because it is inflexible, as it requires manual creation of the layers and can't be done at runtime, as well as not scaling well for larger puzzles.

    I'm not sure if 36 layers would have any performance issues, but I suspect it might, since (I think) force own texture will draw each layer individually, and drawing your entire screen 36 times over every tick sounds like it might run into fill rate issues. The more layers you have the problem will only get worse, so again it is inflexible and unscalable.

    As will all performance issues, try it out yourself and test if it is acceptable on your target platform.

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