15154
DEMO -> Other
© _Public_Domain_ (2018)
 
 
 
Frog Pond Collision Test
cpc
 
 

Last Update : Sunday 27 May 2018 at 15 h 15

Manual n° 1

Frog in a Pond Collision Test How it works Line Function 100-160 Setup Variables, Array & Test Collision Points for cx & cy array 170 Set Screen Mode, Inks, Border & Set Screen Write Mode to Fill 180-210 Draw Pond 220 Define Frog 230 Initial Coordinates of Frog & x, y direction to move frog 240 Set Screen Write Mode to XOR. 250 Main Loop 260 Draw Frog in Grphics Mode using Graphics Pen 1 270-290 Test Top side of Frog, if any of the check points return Graphics Pen 2, change Y direction of The Frog. 300-320 As above, though checks Right Side of Frog and change X direction of the Frog. 330-350 As above, though checks Left Side of Frog. 360-380 And this checks the Bottom side of Frog. 390 Update old positions & new positions, also update new coorinates for array positions. 400 Uses old coorinate position to delete frog by print over itself. 410 End of Main Loop returning to Line 260 as Loop is infinite. 1000-1030 This Routine takes all 16 Check Points (x & y) which were placed around frog and calculates the new positions around the newly drawn frog. The Program: 100 DEFINT a-z:DIM cx(16),cy(16) 110 FOR l=1 TO 16 120 READ cx(l),cy(l) 130 NEXT l 140 DATA 344,202,324,200,328,200,332,200,336,200,340,200,352,198 150 DATA 352,196,348,194,348,190,316,196,316,192,316,188,324,184 160 DATA 336,186,340,186 170 MODE 0:INK 0,11:INK 1,26:BORDER 11:PRINT CHR$(23)+CHR$(0); 180 PLOT 150,100,2:DRAWR 100,25:DRAWR 100,-25:DRAWR -25,-10:DRAWR 100,8 190 DRAWR 100,-8:DRAWR -4,100:DRAWR 4,100 200 DRAWR -100,-8:DRAWR -100,8 210 DRAWR -25,-10:DRAWR -100,-25:DRAWR -100,25:DRAWR 50,-180 220 SYMBOL 255,2,125,191,50,228,90,204,64 230 x=320:y=200:xd=4:yd=-2 240 PRINT CHR$(23)+CHR$(1); 250 WHILE 1 260 PLOT -2,-2,1:MOVE x,y:TAG:PRINT CHR$(255);:TAGOFF 270 FOR ct=1 TO 6 280 IF TEST(cx(ct),cy(ct))=2 THEN yd=-2 290 NEXT ct 300 FOR cr=7 TO 10 310 IF TEST(cx(cr),cy(cr))=2 THEN xd=-4 320 NEXT cr 330 FOR cl=11 TO 13 340 IF TEST(cx(cl),cy(cl))=2 THEN xd=4 350 NEXT cl 360 FOR cb=14 TO 16 370 IF TEST(cx(cb),cy(cb))=2 THEN yd=2 380 NEXT cb 390 ox=x:oy=y:x=x+xd:y=y+yd:GOSUB 1000 400 TAG:MOVE ox,oy:PRINT CHR$(255);:TAGOFF 410 WEND 1000 FOR c=1 TO 16 1010 cx(c)=cx(c)+xd:cy(c)=cy(c)+yd 1020 NEXT c 1030 RETURN


Goto Top
CPC-POWER/CPCSOFTS, programming by Kukulcan © 2007-2018 all rights reserved.
Reproduction forbidden without any express authorization. All the game titles used belong to their respective owners.