love.graphics() is confusing :/

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
Darkhalo45
Prole
Posts: 1
Joined: Sat Apr 02, 2016 10:29 pm

love.graphics() is confusing :/

Post by Darkhalo45 »

I can't quit understand how the love.graphics works. What I mean is, for example, in love.graphics.setColor() you don't define which object you want the color to change. Same goes for most of other love.graphics commands. How do you know which object's color is going to change?
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: love.graphics() is confusing :/

Post by slime »

The set* functions generally affect everything that's drawn after they're called. So to change the color of something, call love.graphics.setColor and then draw the thing directly after.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: love.graphics() is confusing :/

Post by s-ol »

slime wrote:The set* functions generally affect everything that's drawn after they're called. So to change the color of something, call love.graphics.setColor and then draw the thing directly after.
it should be noted that while usually you mean the object directly after, the setting persists indefinetely and until it is overriden by another .setColor() or restored by a .push("all")/.pop().

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

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