Image saving and creation help.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Astormooke
Prole
Posts: 2
Joined: Sun Nov 18, 2012 1:26 pm

Image saving and creation help.

Post by Astormooke »

I have a small game I have been working on this weekend, so far the game detects collisions to walls and I can fire a bullet. However I am in need of a way to create an image for the walls. I have a table that holds all of the coordinates of where the walls will be in collision with the player and drawing on those coordinates takes far to much time to do every time I draw to the screen. Now I dont have to save the image but is there anyway to compile all of those points into one image like a sprite and refresh it like that. If there are any Ideas or help it would be great to hear them. Thank you in advance


I got it to run a bit smoother using a sprite batch but I would still like it to run faster by saving that image and cant seem to get it to save with the image encoder in love2d is there any example code someone could offer on how to use the encodeImage and saving that to a png or bmp thanks again in advance.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Image saving and creation help.

Post by Roland_Yonaba »

I don't really catch the exact problem, but it seems you need to create, edit an image (maybe pixel per pixel) and export it.
Then basically, you create a new ImageData. Then you use imageData functions to edit some pixel, to change their colors.
When done, you can export it with ImageData:encode. Note that resulting file will be located out of the game folder, as love.filesystem only writes in the AppData folder. You'll need to set the game identity before all (to have a valid save folder) where you can grab the exported pic.
Hope this helps, anyway.
Astormooke
Prole
Posts: 2
Joined: Sun Nov 18, 2012 1:26 pm

Re: Image saving and creation help.

Post by Astormooke »

Hey thanks for the reply! I have decided that the way I was going at things was completely wrong... well maybe not wrong but inefficient and with these things its all about efficiency. But it was a learning experience, thank you for the reply again.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests