getting color value by pixel

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
fmra
Prole
Posts: 11
Joined: Fri Nov 29, 2013 9:39 pm

getting color value by pixel

Post by fmra »

Is there a way in LOVE to return the color values of a single pixel? I'm trying to set collision between a character and map areas (walls) using a bumpmap where black indicates passable areas and white indicates impassable areas.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: getting color value by pixel

Post by Plu »

Yeah, you have to create an imageData object from your file first:

http://love2d.org/wiki/love.image.newImageData

That comes with a getPixel() method, which does what you want :)
fmra
Prole
Posts: 11
Joined: Fri Nov 29, 2013 9:39 pm

Re: getting color value by pixel

Post by fmra »

Fantastic. Thank you
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests