12.07.2015 Views

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 14-COLLISION COURSE 159l!i' D$ = CHR$ (4)2!i' PRINT D$ "BLOAD XFSHAPE"3!i' MY, = 5 :M = 58!i' REM85 POKE 232,Y,: POKE 233 , 39!i' HGR : HCOLOR = 3 : ROT = Ii': SCALE = 1l!i'!i' DRAW 1 AT 14!i',5!i'11 XDRAW 2 AT M,15!i'12!i' REMl3!i' REM CHECK PADDLE14!i' REM BUTTON15!i' REM16!i' IF PEEK ( -16287) > 127 THENGOSUB 5!i'!i'17!i' REM18!i' REM MOVE MISSILE19!i' REM2!i'!i' IF PDL (!i') < 9!i' THEN M = M-2 :GOTO 22!i'21!i' IF PDL (!i') > 15!i' THEN IF M < 277THEN M = M + 222!i' IF M < 1 THEN M = 123!i' IF M = Mli' GOTO 25!i'24!i' XDRAW 2 AT MY,,15!i' : XDRAW 2 AT M,15!i':M!i' = M25!i' GOTO 15!i'48!i' REM49!i' REM COLLISION DETECT5!i'!i' REM51!i' REM WE ' LL PUT THIS IN SHORTLY !52!i' PRINT CHR$(7) :RETURNListing 14-1.This listing will g<strong>et</strong> the spider onto the screen and the missile movingunder paddle control. When you press the paddle 0 button the <strong>computer</strong>will beep at you, which indicates that the (as y<strong>et</strong> non-existent) fire/coll ision-d<strong>et</strong>ect routine has been c<strong>al</strong>led.M0 is the "old" X-coordinate of the missile, and M is the new one. Themissile is moved by decrementing or incrementing M (lines 200 and 210),then XDRAWing to erase the old missile, and then XDRAWing again toplot the new one (line 240).After you have the missile moving across the bottom of the screen, wewill t<strong>al</strong>k about the collision routine. Ru n the program as you have it so far,and press CTRL-C to recapture control while leaving the spider on thescreen. Imagine that there is a little box drawn around the spider. In fact,put tne box there by typing these four lines from BASIC.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!