moving a polygon

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.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: moving a polygon

Post by davisdude »

Insert self-promotion here.
This will handle collisions for you, if you'd like.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: moving a polygon

Post by Azhukar »

micha wrote:And you can even shorten your code and save one transformation. Replace these lines:

Code: Select all

love.graphics.translate(posX-cx*sx,posY-cy*sx) --first translate to position
love.graphics.scale(sx,sy)
love.graphics.translate(cx,cy) --rotate around center
by these:

Code: Select all

love.graphics.translate(posX,posY) --first translate to position
love.graphics.scale(sx,sy)
Neat, didn't notice that.
Post Reply

Who is online

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