Sep-19-2018, 02:20 PM
(Sep-19-2018, 03:42 AM)mtndewwarrior Wrote: how would i take there second answer and save it as bot_corner_up_to_left or bot_corner_up_to_right depending on what they answer. so that i the equation would know that they typed in left and would save it as bot_corner_up_to_left.
The equation knows that you typed in left because offset_left_or_right is equal to left. You store the information in bot_corner_to_left_or_right regardless of the answer to the first question. You use the combination of offset and bot_corner_to to tell what's going on.
Think about it this way. If offset is 'left', then bot_corner_up_to_left is 'left' or 'right', and bot_corner_up_to_right is undefined/empty. If offset is 'right', then bot_corner_up_to_left is undefined/empty and bot_corner_up_to_right is 'left' or 'right'. So you always have an empty variable. It simplifies your code to combine the two variables, and it never loses information. Then you can use the value of offset to determine the meaning of the bot_corner_to_left_or_right.
You can do it the way you are doing, but it's going to make your code a lot more complicated. Especially if I'm right that there is more to this equation than just what we're talking about. The more complicated your code is, the harder it is going to be to write and maintain. So you want to go for simpler code whenever you can.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures