How do I have an asset only visible through/on top of a different object?

0 favourites
  • 9 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi, I am trying to make a fish that spawns with a texture on top of it. I want the texture of the fish to be a random part of a large gradient block I made in photoshop. So how I have it now is I spawn the fish, a small non detailed black sprite, and then spawn the color texture at the fish + or - a random amount of the texture size. I only want the part of the texture that is on the fish to be shown. I've tried some blend effects but they still show on the ocean, maybe there is a way around that though?

    Thanks for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'll want both of the sprite objects (the base object and the texture) on their own layer, and turn on the "Force own texture" property of that layer. That isolates the layer from the rest of the project.

  • Thank you that's going to work!

  • I've run into a problem with this method. I am planning on having potentially infinite duplicates of these objects potentially overlap. With the current method the textures will overlap onto the wrong base object. Is there a way to prevent this? I was thinking I could have a tiled background pinned to them and shrink it to the size of the fish but I don't know how to make it zoom on anywhere but the top left corner.

  • In that case, you'll probably want to work out a slightly more complicated system using the drawing canvas object.

    You'll use the layer with force own texture as a temporary space to "build" the object and texture, then paste them together onto a drawing canvas object.

  • I haven't been able to get this to work. This is my first time working with the DrawingCanvas object so I'm sure its something simple I'm missing. I have

    When I use the script from the image with the texture having the multiply blend effect active the texture doesn't show on the fish once pasted onto the object. Although without the blend effect the texture is covering the fish in the DrawingCanvas object.

  • Drawing canvas has some nuances to it, I'm not too familiar with it myself.

    If your fish object is the one with the blending mode on it, try pasting the texture first before pasting the fish.

    dropbox.com/s/602zyzqckrzarsy/drawingcanvastextureexample.c3p

  • I still can't get it to work. I know I'm super close and I tried to copy your script exactly to start. I can get it to where they both paste into the object but if I turn on any blend mode they don't show up in the paste. I've tried switching the blend effects on both and switching which get pasted but it doesn't seem to work. The one difference I can see from your example to mine is in the editor, when you move the C icon it doesn't show up unless it is over the texture. Whereas mine shows up everywhere.

    I'm linking my project because at this point I'm really puzzled. The notable script is at the bottom of the event sheet and the objects are on the left of the player character. The layer is "UnderWaterLayerFish"

    drive.google.com/drive/folders/1GNbuqghkWbJAHUvivqSbpHmHh_eyChZ9

  • I went back and saw the "Destination In" option so that is figured out. Should be good to move on from this part then, thanks again.

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