Assume you have a screen that contains N rectangles (all the same size) spread out in a random manner. Choosing any one rectangle determine which other rectangle would be the optimal choose to move to in all 4 directions Up, Down, Left, Right
Rectangles that have any part of another rectangle over them are to be excluded
This is for a card game where there is no mouse, no keyboard, no touch interface, and the ONLY means of navigation is a DPAD that moves the FOCUS from card to card
I remember I did some of those thing in RealBasic when I did the Canvas tutorials. Not sure if they still would run in Xojo but I can try to find it back on some backup if you want.
I know!!! It looks like all the cool kids from the old days are here. I did not know this forum existed else I would have joined much earlier. I donât dare to write anything on the âotherâ forum because I was afraid to be kicked as soon as I replied with anything not directly related to Xojo
I need to calculate the optimum routes between cards, the routes must follow ONLY horizontal or vertical paths, There may (will) be focus points where a path does or can change direction (where two lines in the image intersect).
So in this example⌠to move from the top left card to the card out in the middle would take 4 moves. 3 horizontal (stopping at each node), and one vertical
@Alwaysbusy answer will do that for you. You know the X & Y co-ordinates, so you know two sides of a triangle, then you can calculate the 3rd side and thatâs your distance.
No Sam , actually it wonât⌠as the requirement is the paths must follow only HORIZONTAL or VERTICAL pathsâŚ
Look at the image above the cursor can only move along the white line and will stop at each intersection
But not to worry I have solved this puzzle.
The solution is actually quite simple. Take for example the user wishes to move RIGHT
The app scans in a horizontal line from where the âcursorâ is to the far edge of the screen.
If the next scanned point is directly above or below the MidX of a card, it stops. The user can then press Right again to continue in that direction or UP/Down where a similar algoritim takes over.
I have already implemented this (and Norman has agreed to test this and other functions of the app for me). This by the way is on an Apple TV for anyone interested.
I read your review on Web 2.0, I thought it was a very fair write-up with some great technical information that Xojo could use to improve their product. Good Job.
I think it is a habit @samRowlands. Most of the time you are giving the solution and now it seems people donât even bother reading your post and just accept it.
Donât get upset guys⌠.you both misunderstood the problem⌠no worries.
And sometimes just stating the problem in writing gives insight to a possible solution, which is exactly what happened in this case. Thanks.