jim wrote:name: jim
Comments: hello
in quickbasic 4.5 i used to use a function but i cannot remember the name!
when i use the draw command to draw a line say at an angle and 100 long, there is a way of finding out which x and y it has reached.
what is that command?
thanks
Jim
QB45 Draw Command Help
QB45 Draw Command Help
Hey guys, I got this question in my email, and I'm not familiar with this command. I'd look it up, but I'm in a rush. Any ideas?
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
Hmm.... DRAW statment, well, for what he wants... He'd need to take the angle at which it was cast, find its SIN()for Y, then times it into the distance travled to get the distance of Y.. then repeat it for X using COS... Then to find the new location, add the distance of X and Y to the old X and Y.. Example, pesido mostly, I never worked with DRAW much...
That should do the trick...
Code: Select all
'Draw line 45deg angle, 100 pixels long
RAD! = 45 * 3.14 / 180
Y! = 100 * SIN(RAD!)
X! = 100 * COS(RAD!)
XLOC! = OLDX + X!
YLOC! = OLDY + Y!
PRINT XLOC!; " "; YLOC!
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
From QB 4.5's online help, this should be what he's looking for.
────────────────────────────────────────────────────────────────────────────
POINT(0) returns current X
POINT(1) returns current Y
────────────────────────────────────────────────────────────────────────────
Code: Select all
POINT Function Details
Syntax
POINT (x,y)
POINT (number)
The coordinates x and y refer to the pixel being evaluated by the POINT
function. When called with two coordinates, POINT returns the color number
of the indicated pixel. If the specified pixel is out of range, POINT
returns the value -1.
POINT with one argument (as explained in the list below) allows
the user to retrieve the current graphics-cursor coordinates.
Argument Value Returned
0 The current physical x coordinate.
1 The current physical y coordinate.
2 The current view x coordinate. This returns the same
value as the POINT(0) function if the WINDOW statement
has not been used.
3 The current view y coordinate. This returns the same
value as the POINT(1) function if the WINDOW statement
has not been used.
POINT(1) returns current Y
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
see that's the kind of thing
there's a lot of people on this forum (maybe everyone) that know more about programming than i do. and i'm sure you know more about php, css and the like, pete. i'm kind of surprised you didn't know point() but that's just it. sometimes people don't know some really important commands. point is on my tutorial. you might like it / it might be really good after all.
Re: see that's the kind of thing
Well, that's the one thing I don't really like about QB - duplicate definition functions. Especially when you don't have a reference handy (*hugs GWBasic Manual*) it's a bit confusing sometimes. SCREEN in its other use doesn't have much use in graphical programs but for text mode it's really helpful, but I doubt if more than half of QB programmers know about the second usage.mennonite wrote:there's a lot of people on this forum (maybe everyone) that know more about programming than i do. and i'm sure you know more about php, css and the like, pete. i'm kind of surprised you didn't know point() but that's just it. sometimes people don't know some really important commands. point is on my tutorial. you might like it / it might be really good after all.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.
Xerol's Music - Updated Regularly!
Xerol's Music - Updated Regularly!
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
That would be good to have ..
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki
That might be helpful in some cases. FB has almost 90% of all QB commands, just skip over the new add on's for a nicely made QB help....
That might be helpful in some cases. FB has almost 90% of all QB commands, just skip over the new add on's for a nicely made QB help....
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
Re: see that's the kind of thing
ah, yeah, screen being the text mode equiv of the point statement in this post... it covers that too... also yeah, wiki = good. the first big fb program i made by the way, was text mode and used screen... the function you mentioned, not the commandXerol wrote:SCREEN in its other use doesn't have much use in graphical programs but for text mode it's really helpful, but I doubt if more than half of QB programmers know about the second usage.