Masking with blend modes?

Discussion and feedback on Construct 2

Post » Fri Dec 27, 2013 2:23 pm

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!
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Fri Dec 27, 2013 2:35 pm

@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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,487
Reputation: 59,760

Post » Fri Dec 27, 2013 2:40 pm

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.
ImageImageImage
B
71
S
22
G
248
Posts: 3,758
Reputation: 138,067

Post » Fri Dec 27, 2013 2:46 pm

@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! ChrisAlgoo2013-12-27 14:48:30
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Fri Dec 27, 2013 2:48 pm

@blackhornet - Thanks! Is that a plugin? I can't find that in the manual.
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Fri Dec 27, 2013 3:11 pm

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

SetColorWhiteblackhornet2013-12-27 15:21:06
ImageImageImage
B
71
S
22
G
248
Posts: 3,758
Reputation: 138,067

Post » Fri Dec 27, 2013 3:31 pm

Cool, I'll investigate that. Thank you!
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Fri Dec 27, 2013 3:47 pm

[QUOTE=ChrisAlgoo]
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. [/QUOTE] 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.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Fri Dec 27, 2013 10:46 pm

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.Squidget2013-12-27 22:47:36
B
7
S
1
Posts: 45
Reputation: 1,315


Return to Construct 2 General

Who is online

Users browsing this forum: humanescape and 7 guests