Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!207.24.245.130!nyd.news.ans.net!news.idt.net!netnews.com!news.maxwell.syr.edu!nntp2.dejanews.com!nnrp1.dejanews.com!not-for-mail From: bobryan9@my-dejanews.com Newsgroups: comp.sys.apple2.programmer Subject: Re: Apple IIe programming help wanted... Date: Mon, 03 May 1999 00:09:51 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 98 Message-ID: <7gipge$nin$1@nnrp1.dejanews.com> References: NNTP-Posting-Host: 209.79.221.202 X-Article-Creation-Date: Mon May 03 00:09:51 1999 GMT X-Http-User-Agent: Mozilla/4.5 [en] (Win95; I) X-Http-Proxy: 1.0 x16.dejanews.com:80 (Squid/1.1.22) for client 209.79.221.202 Xref: news1.icaen comp.sys.apple2.programmer:10548 ***I'm interested in writing a lo-res maze-like game and need to know a few ***things... ***1) How do you control a PLOT "brick" (player and game characters) with the ***arrow keys on a PC keyboard? At the very least, what command(s) are used to ***activate Apple joystick control. There's probably a way to remap the ***control to other PC keys, as need be. I assume a string command would be ***used, but I haven't a clue as to which one. PLOT X,Y X can be 0-39 Y can be 0-39 A=PDL(0) A will be 0-255 depending on joystick (up/down) B=PDL(1) B will be 0-255 depending on joystick (left/right) GR switches to LORES graphics COLOR=T T can be from 0 to 15, 0 is BLACK 10 GR: X=10:Y=10 20 XC=0:YC=0 30 IF PDL(0) <50 THEN XC=-1 40 IF PDL(0)>250 THEN XC=1 50 IF PDL(1)<50 THEN YC=-1 60 IF PDL(1)>150 THEN YC=1 70 COLOR=0:PLOT X,Y: REM ERASE 80 X=X+XC:Y=Y+YC 90 IF X<1 THEN X=0: REM ERROR CORRECTION 100 IF Y<1 THEN Y=0 110 IF X>38 THEN X=39 120 IF Y>38 THEN Y=39 130 COLOR=15:PLOT X,Y 150 GOTO 30 The above will move a dot around the screen with joystick. Add: 140 XC=0:YC=0 if you want the dot to stop when you aren't pushing in a direction. ****2) Can you generate walls without having to manually HLIN and VLIN all of ****them in? Yeah, create a simple paint plot program, "paint" your screen, and BSAVE the file to disk. You would then BLOAD an entire LORES screen into memory. ***3) How do you make a game character (represented as a PLOT "brick") run ***around the playfield semi-randomly with variations in speed, as needed? In the above program, DELETE 30-60 , ADD the following between 20 and 70 C=INT(RND(1)*3): REM CAN MOVE 1-3 SPACES D=INT(RND(1)*2): REM CHOOSE + OR - MOVEMENT IF D>1 THEN C=C-(C*2) XC=C C=INT(RND(1)*3) D=INT(RND(1)*2) IF D>1 THEN C=C-(C*2) YC=C ****4) How do you detect collision between your character (also a PLOT "brick") ****and the walls or a game character? I assume keeping all individual elements ****(player/computer character/maze walls) as separate colors would help in this ****respect. BEFORE you make X=X+XC and Y=Y+YC, do this: DETECT=SCRN(X+XC,Y+YC)................... That will give you the COLOR of the pixel you are about to move to. You need to make walls one color (you just bounce off them, or get hurt by them), enemies another color (get hurt by a certain color). ***5) How do you (or can you?) incorporate text on the game screen? You have a few lines below the LORES screen to print on. You have to VTAB 22 or so to print on them. If you build an interrupt generator, you can mix TEXT with LORES, but that is going to your elbo to scratch your @$$. Either make your own HUGE fonts out of lores dots, or use the bottom of the screen. REMEMBER to issue the GR command to get to lores graphics. ****I apologize for rambling on like this, but I'd love to learn how to program ****in BASIC and simply haven't found the book(s) or people interested enough to ****teach me. ****Please reply directly to: luposian@mailcity.com ****Thank you. Was this direct enough? Send me any other questions you have. I have some books I'll sell you, so you can start doing some serious BASIC programming! Bob -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own