Hello love2d
This is my first post and in this I want to share and seek some information.I got introduced to love2d through game 'Journey to the center of Hawkthorne (fan made game based on community TV show) and I wanted to create an effect of shadow on wall for fun after some head banging i came up with this solution.
Divide screen into zones(canvas) like Floor ,Ceiling and Wall.For each zone Draw shadow image separately but for 'Ceiling' and 'Floor' skew image according to perspective and for 'Wall' keep it as it is.
My very first love file so code may be ugly ,I have very basic knowledge of Lua .
ScreenShot :
Please tell if it can be done some other way.Thank you!
Distorting image to form shadow on wall [fake perspective.]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Distorting image to form shadow on wall [fake perspective.]
- Attachments
-
- faux perspective.love
- Shadow/Splatter Test by Ohsin
- (5.68 KiB) Downloaded 131 times
Re: Distorting image to form shadow on wall [fake perspectiv
Just an idea: Use love.graphics.setScissor to limit drawing area (floor/ceiling/wall) instead of using canvas.
Re: Distorting image to form shadow on wall [fake perspectiv
How can I use 'scissors' method to create more than one independently drawable area on screen? It seems it can only define an ractangular area to draw on but that's it.I also tried using Quads but i don't know if i can skew them like images.
Re: Distorting image to form shadow on wall [fake perspectiv
You can use a scissor to define an area and draw into it, then use a new scissor to define a new area and draw into it and a last scissor to define a third area to draw into
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Distorting image to form shadow on wall [fake perspectiv
That is exactly what I want ! But if i setScissors then draw then setScissors and draw again.The very first draw area gives weird results.Like in following example ball draws fine in second area but in first it starts to 'paint' the area.Nixola wrote:You can use a scissor to define an area and draw into it, then use a new scissor to define a new area and draw into it and a last scissor to define a third area to draw into
Code: Select all
function love.update()
mx = love.mouse.getX()
my = love.mouse.getY()
end
function love.draw()
love.graphics.setScissor( 0, 0,200,200 )
love.graphics.setColor(255,0,0)
love.graphics.circle("fill", mx, my,50,25)
love.graphics.setScissor( 0, 200,200,200 )
love.graphics.setColor(0,255,0)
love.graphics.circle("fill", mx, my,50,25)
end
Re: Distorting image to form shadow on wall [fake perspectiv
You have to disable the scissor or love.graphics.clear (called just before love.draw) will only clear that part of the screen. Just call love.graphics.setScissor without arguments to do that:
Code: Select all
love.graphics.setScissor()
Shallow indentations.
Re: Distorting image to form shadow on wall [fake perspectiv
That did it! Thank you very much. I should have used it just like setCanvas ...silly me
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 7 guests