Hello.
Is there any way to edit sprites I loaded? For example, if I loaded car from .png with newimage and then suddenly want to remove top half of it, or make it covered with green paint somewhere, or, I dunno, anything that can't be done with just dividing one whole car sprite to different car parts sprites. Just change color and opacity of x;y pixel in loaded image from lua. Is it possible?
If no, are there other ways to make something like, emm, voxel 2d physics? Is there something I missed in love modules? Because I want to make just normal game, with sprites, but sometimes behaving like 2d-minecraft.
If no, are you going to add functionality like this to LÖVE?
If no, can I or my friends add it? Would you like it?
If no, then... then...
Editing sprites in video memory
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Editing sprites in video memory
Welcome.
As for your first question, see ImageData:setPixel. Note that you need to create an ImageData from your file, edit it and then make an image, with love.graphics.newImage (the last variant). Note that changing every pixel individually can be quite slow, you might want to explore different options.
As for your first question, see ImageData:setPixel. Note that you need to create an ImageData from your file, edit it and then make an image, with love.graphics.newImage (the last variant). Note that changing every pixel individually can be quite slow, you might want to explore different options.
Help us help you: attach a .love.
Re: Editing sprites in video memory
I'd say it would be more efficient to have several sprites with all the different colors/stains you would need and then simply switch between them as needed. Alternatively, you could keep the main car sprite and overlay it with some stains/scatches/etc, using another image loaded separately. Pixel by pixel editing is a framerate nightmare...
Did my comment help/offended you? Use the Karma button!!
LÖVEing each day...
LÖVEing each day...
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 17 guests