Polygon 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
ColourTheory
Prole
Posts: 11
Joined: Tue Jun 05, 2012 8:27 pm

Polygon Image

Post by ColourTheory »

Hello,
I am using love.physics for my game, and that uses polygons for drawing, my question is, how would I make it an image?
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Polygon Image

Post by Plu »

You can use love.graphics.polygon:
http://love2d.org/wiki/love.graphics.polygon

Of course you'll have to map the coördinates of the polygon you are drawing to the ones in the shape.

If you mean an actual image, then you can just use love.graphics.draw to draw an image on top of the polygon shape.

NOTE: love.physics uses the center of an object as x,y and love.graphics uses the top left corner. So if you're seeing weird collision effects, probably the image and its shape aren't overlapping properly.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 12 guests