I have been searching the documentation in the wiki for ways to create a copy of an image, but that has not been successful. I found a clone() function in the section ImageData, but it is referring to Data:clone() rather than ImageData:clone().How do you read that? Is Data the base class of ImageData? I tried the following, by working on the ImageData,but it doesn't work:
Code: Select all
backGroundGph = love.graphics.newImage("gfx/Levels/Background.png")
dat = backGroundGph:getData()
imgData2 = dat:clone()
I'm currently working on a game where I need to take it even one step further and create a copy of only a part of an image in another image.
What I'm trying to do is to create an explosion effect that looks like the enemy explosions in Robotron 2084, where enemies explode in strips.
See Robotron:
https://www.youtube.com/watch?v=aOVA2Axxfdk
I think what I would have to do is to have one image of the enemy graphic, and then copy the strip-parts of that image into separate images which I would then draw drifting apart to create the effect of the explosion. If there is simpler ways to do it, please let me know. I still need to be able to make memory copies of an image for another game where I'd like to recolor the same image over and over again to give each enemy a completely random color.
It would be best for me to have a solution that still works in löve 9.0. Thanks in advance for your suggestions.