0 Members and 1 Guest are viewing this topic.
Well, I'm not going to make the first routine, either you can do it or find someone else, but don't wait for me to post it As for relative positions, that's easy. There are two ways to go about it, and it depends on how you want your ship to move:1. Ship is always dead center of screen: For this, we want to first see how the other ship compares relative to your ship. So (opponentX) - (yourX). That will tell you where they are relative to you. Then, just add the location of your ship on the screen. So lets say that your ship is on X=25 of the physical LCD, then you would add the little math problem from up above to 25 to get your location.Example: (yourX) = 190, (opponentX) = 180, Your 50x50 screen is in the top left corner of the LCD. Your ship is displayed at (25,25) 180 - 190 + 25 = 15. So you would display the enemy at X=15.2. The ship can move freely and the screen scrolls when it gets close to the edge: I'll let you take care of the scrolling, we're only worried about displaying other ships. For this, the equation is just (opponentX) - (scrolledX) + offsetToScreen. It doesn't even matter where (yourX) is.Example: (opponentX) = 180, (scrolledX) = 175, Your 50x50 screen is in the top left corner of the LCD. 180 - 175 + 0 = 5. So you would display the enemy at X=5.