Author Topic: Please Help  (Read 8742 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Please Help
« Reply #15 on: May 23, 2011, 06:56:26 pm »
KK. Thanks everyone. This project is getting dangerously close to beta. I need help with one last routine. This routine should scan the same appvar that the routines above address. It should look for any COORDINATE entries that are 50 units in front of you and, if an entry is found, it should jump to another routine. Coordinate entries are formatted (x,y,z), two bytes each, starting at (xposition) and encompassing the x,y,and z position and the x,y,and z sector.

This info is crucial:  ship direction= 1 forward, 2backward, 3left, 4right, 5up, 6down
               backwards/forwards=y axis, left/right=x axis, up/down= z axis

Another question, but I'll code this myself...I need to place sprites on the screen in a relative position. The viewing window covers 50 units left-to-right. I need a way to determine where to place a ship on the screen. Thus, a ship with an x coordinate less than yours as you move forwards will appear on the left side of your screen. Any idea on how to do this, mathematically? Thanks.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Please Help
« Reply #16 on: May 27, 2011, 10:46:50 am »
^^Bumpity bump.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Please Help
« Reply #17 on: May 27, 2011, 04:38:03 pm »
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.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Please Help
« Reply #18 on: November 26, 2011, 12:24:26 pm »
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.

Ok, sorry. I hiatused this for a while and am back to it now. The original routines you gave me to search for stuff in the appvar, i will be using, however the format is now: 5-byte ID, 8-byte username, 6-byte coordinates (2 for x, 2 for y, 2 for z), and 3 byte sector (1 for x, 1 for y, 1 for z). Plus, I will be using saferam, rather than an appvar, so it should make this easier, right? Once we edit those original routines that search for username, ID, or coordinate, I should be able to handle the rest.
« Last Edit: November 26, 2011, 12:25:45 pm by ACagliano »

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Please Help
« Reply #19 on: November 26, 2011, 12:26:18 pm »
Yep, or if you need more space. You can just throw the extra ram page in the $4000 region and use that.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Please Help
« Reply #20 on: November 26, 2011, 12:42:27 pm »
well, i cap at 30 members to a server, so...30x21 is 630 bytes...fittable within saferam1. :)