Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coordinates off screen

Status
Not open for further replies.

Beholder2

Technical User
Sep 27, 2004
31
US
I am making a game is qb4.5 its a dungeon explorer like the old game Eye of the beholder, where you move one
square at a time and you can side step and turn. What I want to be able to do is load a previously designed map
and have that as the dungeon you can move through. Sort of like the level-creators for doom2 if anyone remembers
them like deu2 and waded. The problem I am having is connecting two points where one point is the origin in a
200x200 box and the other is actually not a coordinate on the screen. So what I need to know is how do I know
the x,y coordinates of the point just before the line leaves the screen? Or using math how can I find the x,y?
 
I'm having difficulty understanding what the problem is. It seems pretty simple since you can use negative x,y coordinates. I'm sure there's something more to it than that though.
Could you clarify your problem and toss in some examples and/or code you're working with?
 
Well its a little tricky to explain. picture a map a classic dungeons and dragons map the ones that look like crossword puzzles that you do on grid paper. I convert that to a 3d view where you can move one space at a time either forward, backward, turn left turn right, thats it. So i translate the 2d map into a 3d coordinates now if you want to figure out where a diagonal line goes for anything not in the center you have to reference it to a logical point off screen. Ah thats the best explaination I can give without a picture, the code would only confuse it more. Picture a square 201x201 and in that square is a smaller square then a smaller and smaller etc... until we get to the center. it will look like a passage if you connect the four corners of the first square with the center (diagonals). Now say the 3rd square in has a square of equal size adjacent to it on the right (equations work out the same for left or right) now we want to draw the diagonals for that square, keeping in mind anything beyond 201 is classified as offscreen so now because we're one square to the right the diagonals to give it depth connect not to the corners of the first square (screen square)as with the one centered but to an adjecent square by the first. so in other words the first square is (x,y) (0,0)-(200,200) the one beside it is (200,0)-(400,200)
and the diagonals for this 3rd square in connect to the corners of it. So if we want to say we have the 3rd square three squares along the square we connect the diagonls to is offscreen and anything more than that is also offscreen. So how can I do the diagonals without getting an illegal function call?
 
I understand what you're trying to do and it makes sense how it works. I guess I need to know the exact command that gives you an illegal function call. Normally, commands like DRAW or LINE don't have any problems with negative coordinates, or coordinates outside of your VIEW SCREEN, but commands like PUT simply won't. If it is a PUT command, I don't know of any work around to putting it outside of the VIEW SCREEN area.
Either way, which command gives the error?
 
Its pset that returns an illegal function call. You know though I think I'm going to have to use a different method using formulas that instead tell me the last pixel coordinate before the line goes offscreen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top