I'm still learning a little Lua, though I have a decent understanding of how it works. Being the newbie I am I have become stumped.
Say I have an image called "rake.png." It is draggable by the mouse. How can I draw an image called "raketrail.png" from rake.png if rake is being dragged?
Much appreciated!
Drawing an Image FROM and Image
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Drawing an Image FROM and Image
Looks like you need to learn about ParticleSystems.
You can find example code in particles.love in the demos zip archive.
You can find example code in particles.love in the demos zip archive.
Re: Drawing an Image FROM and Image
thelinx wrote:Looks like you need to learn about ParticleSystems.
You can find example code in particles.love in the demos zip archive.
Oh my ... that seems very complex. Would anyone be able to just post a finished code based on what I asked for? Although I'm definitely going to read up on what Linx posted, I also learn fairly well from examining the code myself.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Drawing an Image FROM and Image
Define "draw an image from an image".
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: Drawing an Image FROM and Image
Say I have an image called rake.png and it is draggable. I would like an image named raketrail.png to become drawn from the mouse while rake.png is dragged.Taehl wrote:Define "draw an image from an image".
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Drawing an Image FROM and Image
So far as I know, the name for that sort of thing is a "ribbon" (at least, that's what Blizzard calls them in all their games). Love, unfortunately, doesn't offer a way of drawing ribbons (yet?). I wish it did, though.
However, even if there isn't a proper way to do it, you can still fake it. A few possibilities I can think of:
- Make it pixel-art or somehow tile-based, so you don't need to draw an exact, detailed trail
- Draw a circle under each tine every frame that the rake is down, but draw it to a framebuffer instead of the screen. As long as you don't clear the framebuffer, you'll get the furrow trails you want.
- Make your own ribbon system using lots of image transforms (I'd suggest looking into the 3D dice roller demo to see the math and methods for skewing an image).
However, even if there isn't a proper way to do it, you can still fake it. A few possibilities I can think of:
- Make it pixel-art or somehow tile-based, so you don't need to draw an exact, detailed trail
- Draw a circle under each tine every frame that the rake is down, but draw it to a framebuffer instead of the screen. As long as you don't clear the framebuffer, you'll get the furrow trails you want.
- Make your own ribbon system using lots of image transforms (I'd suggest looking into the 3D dice roller demo to see the math and methods for skewing an image).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: Drawing an Image FROM and Image
Darn,it stinks that there's no way to make one of these ribbons.Thanks for the useful info anyway!
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Drawing an Image FROM and Image
Create a blank framebuffer and draw to it without clearing. Every frame decrement the opacity of each pixel. I can't remember if 0.7.2 has the explicit framebuffer clearing or if 0.8.0 does.Taehl wrote:Love, unfortunately, doesn't offer a way of drawing ribbons (yet?). I wish it did, though.
EDIT: Indeed it requires LOVE 0.8.0. BEWARE! This example isn't dt based.
- Attachments
-
- ribbons.love
- 0.8.0
- (147.93 KiB) Downloaded 162 times
Re: Drawing an Image FROM and Image
How would one obtain LOVE 0.8.0?TechnoCat wrote:Create a blank framebuffer and draw to it without clearing. Every frame decrement the opacity of each pixel. I can't remember if 0.7.2 has the explicit framebuffer clearing or if 0.8.0 does.Taehl wrote:Love, unfortunately, doesn't offer a way of drawing ribbons (yet?). I wish it did, though.
EDIT: Indeed it requires LOVE 0.8.0. BEWARE! This example isn't dt based.
Re: Drawing an Image FROM and Image
It's not out yet, but if you're running Windows, you can get nightly builds here:
http://love2d.org/builds/
Beware that stuff which works fine on the wiki/forums for 0.7.2 might fail horribly under 0.8.0.
http://love2d.org/builds/
Beware that stuff which works fine on the wiki/forums for 0.7.2 might fail horribly under 0.8.0.
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests