Okay I can understand that, thanks for the clarification!DaedalusYoung wrote:Because you need to have a variable to remember the currently selected colour. In Zilarrezko's code, you can see this, it is called currentColor. If you use numbers here, you can directly use that number to set the selected colour in love.draw.
If you use unique names for each colour, you can't do this, you'd have to make some strange and long if-block, like this:You can see how that is ugly and bulky. In addition, if you ever decide you want to change the colours; shuffle them up, or make a whole new palette, then you're either stuck with these old names, or you have to go through your entire program and change the variable names everywhere.Code: Select all
if currentColor == 1 then love.graphics.setColor(Red) elseif currentColor == 2 then love.graphics.setColor(Orange) elseif currentColor == 3 then love.graphics.setColor(Yellow) -- and so on end
[SOLVED]Picking colours and see what current colour you have
Re: Help: Picking colours and see what current colour you ha
Have a good day!
Who is online
Users browsing this forum: Bing [Bot] and 16 guests