Re: ASCII meets games
From Rafal Slubowski <raf...@paputek.decsoft.com.pl>
· alt.ascii-art
· 6 Apr 2000 00:00 · View full thread
· report
On Sun, 2 Apr 2000 19:07:38 +0200, "Nacken" <jna...@casema.net> wrote: [...] >I do a lot of programming in QuickBasic. Right now, I'm working on >a game, especially for the old XT-pc's. Therefore, I can't draw lines or set >points, and I must use the ASCII-characters for a substitute for gfx. A) There is aa-lib library for C-language on Linux system. Maybe You should watch its sources, and see how the graphics is made. B) How old is your XT-pc? Haven't it either HGC graphic card? 8-O C) The simplest agoritm is drawing horizontal/vertical line. You should use '|' and ('-' or '_') signs. Let's assume that parameters of procedure are (x1,y1, x2,y2) - x-y positions of beginning and end of line. Its also possible to use tilda ('~') sign, but it's height is different in different fonts. For horizontal line use: for i=x1 to x2 print at (i,y1) "-" {sorry, I don't remember QB syntax :-(} next i For vertical line use: for i=y1 to y2 print at (x1,i) "|" next i It is also simple to draw 45/135 degree lines. Guess how? ;-) The more difficult is drawing lines with other angles. Algoritm could be like that: 0) check that y1<>y2. In other case you'll get "Division by zero" error in next point! 1) alfa = arctan((y2-y1)/(x2-x1)) 2) if alfa > 45[1] degrees you should use "for y" loop if not, "for x" loop would be better. 2a) if alfa < 45 then line should look like this: 1 2 3 4 5 6 7 8 9 segments | | | | | | | | | 1 y1- --..__ 2 ``--..__ 3 y2- ``--- | | x1 x2 12345678901234567890 so for each character line (|y2-y1| gives you number of lines) you should use four characters. Count number of different segments... numparts=(|y2-y1| * 4)+1 {|3-1|*4 +1 = 9} ...and number of character for one segment: numchar=(|x2-x1| div numparts) {(|20-1| div 9) = 2} Now, two nested loops (inside should be loop for drawing one segment, and outside loop would be "for x" loop) should work fine. 2b) Algoritm is analogue to 2a), but I don't know which characters you should use. :-( See a.a-a FAQ. And that's all. Hope it will help you. :-) [1] I know, this is not full condition, but... PS.Sorry for my language, I'm not English native-speaker :-) -- Rafal Slubowski \\ raf...@paputek.decsoft.com.pl /O `----. www.slubek.w.pl * (_.-. )\ *|* rs //--// X
Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,404e16a6422c1707 X-Google-Attributes: gidf996b,public From: raf...@paputek.decsoft.com.pl (Rafal Slubowski) Subject: Re: ASCII meets games Date: 2000/04/06 Message-ID: <38e...@news.tpnet.pl>#1/1 X-Deja-AN: 607462555 References: <8c7ulh$gim$1...@newsspool.casema.net> X-Complaints-To: abu...@tpsa.pl X-Trace: news.tpnet.pl 955012928 195.117.230.155 (Thu, 06 Apr 2000 11:22:08 MET DST) Organization: Decsoft sp.z o.o. NNTP-Posting-Date: Thu, 06 Apr 2000 11:22:08 MET DST Newsgroups: alt.ascii-art
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
|\/\/\/| | | | | | (o)(o) C _) | ,___| | / /____\
|HHHHH/"\"\HHHHHHH| |HH`\|_.-)'|/'dP,H| |Hb.`\\_/_//'.oddH| |HHHb|`.\/\,'|HHHH| |HHHHHb/\/\/|HHHHH| |"""""""""""""""""| | |"" /\ \ / |"" | | |__/--\ \/ __| |
_________
/___ ___\
//@@@\ /@@@\\
\\@@@/ \@@@//
\___ " ___/
| - |
\_/ jrjc ______
/|_||_\`.__
( _ _ _\
=`-(_)--(_)-'
hjw .="=. _/.-.-.\_ ( ( o o ) ) |/ " \| \'---'/jgs /`"""`\\
_________ | _____ |\ | |\ ___| | \ | | | | | | | | |___| | | \ | |____\| | \|_________| Andy Johnson
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this message.
This message was posted publicly to the newsgroup
alt.ascii-art
in 2000 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.