Re: Regarding placing/removing blocks in game.
Posted: Mon Oct 10, 2011 7:30 pm
Thanks.Taehl wrote:Just a quick note, but you don't need to check if something equals true - unless the variable is nil or false, it will be evaluated as true. Likewise, saying "a and b" ITSELF will equal true or false. It sounds crazy, but short-circuit evaluation is really handy and convenient once you get comfortable with it. For example, your statement:could be written as merelyCode: Select all
if ((x > 0 and x < 21) == true) and ((y > 279 and y < 301) == true) then
It reads much more easily, doesn't it?Code: Select all
if x > 0 and x < 21 and y > 279 and y < 301 then
This was another thing that took me FOREVER to run properly. The solution I had was way too bulky, I know.