Okay, so I am still getting in to Java, but I am at the stage where I am sick of using IF statements for everything, and I need another way of doing something (because I can't really do it with IF).
What I want to do, is have a map with squares (already done that bit) that are each 50 pixels, and when someone clicks on one of the squares, the character gets taken to that square.
I did manage this with making an IF statement for every single square, and have 'SquareX1' and 'SquareY1' as the variables that made up each square. But I want big maps (I am planning on a large scale TBS), and I don't want any future coding to have to be added to the 100+ IF statements.
So, my question is: Is there a way to make this work, without the use of IF statements? Like, something which would know if you clicked the square at 350px by 450px, and move the character there, without it having a variable preassigned to that specific square?
Thanks a lot, and I have been rewatching all the tutorials I could to find a way, and all I could think of was using a While Loop, or an Array - both of which would only make it take a bit less time.
Danny
What I want to do, is have a map with squares (already done that bit) that are each 50 pixels, and when someone clicks on one of the squares, the character gets taken to that square.
I did manage this with making an IF statement for every single square, and have 'SquareX1' and 'SquareY1' as the variables that made up each square. But I want big maps (I am planning on a large scale TBS), and I don't want any future coding to have to be added to the 100+ IF statements.
So, my question is: Is there a way to make this work, without the use of IF statements? Like, something which would know if you clicked the square at 350px by 450px, and move the character there, without it having a variable preassigned to that specific square?
Thanks a lot, and I have been rewatching all the tutorials I could to find a way, and all I could think of was using a While Loop, or an Array - both of which would only make it take a bit less time.
Danny