## Unmoving plaid effect

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
tuupakku
Prole
Posts: 21
Joined: Fri Feb 12, 2016 12:12 pm

### Unmoving plaid effect

I have been trying to achieve an unmoving plaid effect in LÖVE without much success for a while now. I was wondering how you guys would implement this.

In case you don't know what unmoving plaid is, think of the characters' clothing in Chowder or Stan in Monkey Island:

It's basically a static background that is masked and only shown in a certain part of the scene, usually in characters' clothing.

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

### Re: Unmoving plaid effect

I'm not sure how you would do it, but this game does that. I think you use stencils IIR.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

pgimeno
Party member
Posts: 1871
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

### Re: Unmoving plaid effect

I can think of two ways. One is to put the unmoving image as background, and make the animation using alpha. The other is using a shader. The shader has the advantage that you can easily have two simultaneous unmoving plaids with different textures without overlapping.

(While I was writing this, davisdude gave another solution using stencils. That may work as well.)
Attachments
unmoving-alpha.love

tuupakku
Prole
Posts: 21
Joined: Fri Feb 12, 2016 12:12 pm

### Re: Unmoving plaid effect

Thanks for the help, the shader solution seems to be the better one here, even though I have never used shaders before and they look scarily complex. I'll look up a guide on them and get over my fear haha.

Once again, thanks.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Unmoving plaid effect

Now that I read this thread I wonder why I used the stencil method in the first place (game linked above is mine). By just sampling the texture using the screen coordinates things are pretty simple and all the transforms are much easier too.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

pgimeno
Party member
Posts: 1871
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

### Re: Unmoving plaid effect

Re shaders, I learned with the blog: http://blogs.love2d.org/content/beginners-guide-shaders - it's an excellent introduction.

### Who is online

Users browsing this forum: No registered users and 11 guests