Which kind of image.

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
scripto
Prole
Posts: 5
Joined: Sun Jan 31, 2010 3:52 am

Which kind of image.

Post by scripto »

hi, i want to learn how to show images on the screen, but idk which kind of image i must use, the one in the graphics or in the image of love? and can you tell me if this kind got position property? also is it possible to make a certain color completly invisible?

thanks scripto
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Which kind of image.

Post by Robin »

Images are loaded with love.graphics.newImage().

They don't have a position property, they are arguments to the love.graphics.draw function:

Code: Select all

function love.draw()
    love.graphics.draw(myimage, x, y)
end
You probably want to keep a variable around for most images. You can use tables for this:

Code: Select all

player = {img = love.graphics.newImage("player.png"), x = 100, y = 200}
scripto wrote:also is it possible to make a certain color completly invisible?
AFAIK not. But many image formats (such as PNG) have alpha channels you can use to make parts invisible. (Or partly visible, for example for ghosts.)
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Which kind of image.

Post by bartbes »

Ah, that reminds me, I wanted to make a lib to do that...
scripto
Prole
Posts: 5
Joined: Sun Jan 31, 2010 3:52 am

Re: Which kind of image.

Post by scripto »

Ok so you can make an image with a png? and for the getPixel and setPixel, is there any ways to use it using love.graphics or is there any way to convert a love.graphic image to a love.image then switch it back once you made your changes?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Which kind of image.

Post by TechnoCat »

scripto wrote:also is it possible to make a certain color completly invisible?
This is either a job for Photoshop, or ImageData!

http://web.ics.purdue.edu/~dcfritz/file ... tract.love

REMINDER: .love files can always be opened as an archive (WinRAR, 7zip, etc). Presumably to view the source code.

UPDATE: Realized you wanted something to subtract a certain color for sprite sheets. This doesn't do that.
Last edited by TechnoCat on Sun Jan 31, 2010 6:32 pm, edited 1 time in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Which kind of image.

Post by bartbes »

I have created and posted a small color masking function in the Projects & Demos section: here
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests