Masking with blend modes?

0 favourites
  • 9 posts
From the Asset Store
Basic template for drawing game with masks and easy customization
  • I'm aware of the various blend modes, and they're awesome, but they seem to blend on all layers. What I would like to do is to, say, have a sprite that's entirely white, and blend it with my player's sprite. It would be invisible most of the time, but would activate when the player is hit, turning the player's sprite white for a little while, and not turning anything else white. Is there any way to do this? If not, can that be implemented? Perhaps setting it so that the blend mode only applies one layer down? Thanks!

  • ChrisAlgoo

    Let me play Devil's Advocate for a moment, so please try not to take offense.

    You propose a change from the developer to the current system due to you wanting to create a particular effect? How is it of benefit to everyone else?

    IMO why can't this just be a triggered change of sprite anim? That's why we can add as many animations to a sprite as we wish.

  • Another alternative (in this case) is to use the SetColor Effect, set to 100,100,100 for white. Use Disable/Enable when needed. This only affects the sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • zenox98 Sure! There are a few reasons why this would be useful.

    1 - If this was done via the animation system, you would have to create additional frames for each possible state. Say that you had a platformer and you wanted to have this sort of system where you flash white after being hit (similar systems occur in lots of games). You would need to make white jumping frames, white running frames, white attacking frames, etc etc. If it's possible to do something programatically and not put additional strain on your art team, it should be done.

    2 - This is an effect that lots of games make use of. The most popular is how enemies in shooter games turn red when they're low on HP - if masking was a feature, we could implement that in 30 seconds with no additional art required.

    3 - You can easily create visual variation with a system like this. For example, one piece of Dragon art can be a Red/Black/Green/White/any other color dragon, without having to export a new set of art for each color.

    There are seriously a ton of uses for a feature like this. IMO, we should hand off as many tasks as we can to the computer. Imagine if we didn't have an opacity control, and had to draw all of our frames in varying levels of transparency if we wanted that effect. It would add so much work!

  • blackhornet - Thanks! Is that a plugin? I can't find that in the manual.

  • No, it's a property. Effects: Add/edit...

    SetColorWhite

  • Cool, I'll investigate that. Thank you!

  • 1 - If this was done via the animation system, you would have to create additional frames for each possible state. Say that you had a platformer and you wanted to have this sort of system where you flash white after being hit (similar systems occur in lots of games). You would need to make white jumping frames, white running frames, white attacking frames, etc etc. If it's possible to do something programatically and not put additional strain on your art team, it should be done. You would just have to make the hurt animation like that, or at least part of it. It's not that many assets and if it is then you're trying to do too many.

    Most of the time you're only get hurt in like 2-3 positions at max.

    Although if there was a method to apply a mask on 1 layer only that would be pretty cool.

  • What you want for this is an Effect applied to the player sprite, not a blend mode. Effects on a sprite will only apply to that single sprite. You can get a decent-looking white flash effect by putting a Brightness effect on your player objects - set the effect parameter to 200 when the player is hit, then gradually scale it back down to 100 over a second or two. You can get more complicated if you want multiple white flashes, but that's the basic idea.

    You can also write your own effects if none of them match your needs.

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