Jump to content

Recommended Posts

I started this topic to put little bits that I was working on in case anyone was interested in them and also to get help on how to improve them. The first is a drawing of several pyramid shapes within a larger pyramid. How can the empty spot in the center be programmed to connect? There is a gaping hole, but not sure how to change the loop so that it would work.

 

10 !RAINBOW
50 ! RAINBOW PYRAMID
60 CALL CLEAR :: CALL SCREEN(2) :: CALL COLOR(9,7,2,10,12,2,11,10,2,12,5,2,13,8,2,14,4,2)
65 CALL COLOR(8,12,2)!YELLOW
70 L$="0102040810204080" :: R$="8040201008040201" :: LC$="01020408102040FF" :: RC$="80402010080402FF" :: H$="00000000000000FF"
80 CALL CHAR(96,L$,97,R$,98,LC$,99,RC$,100,H$,104,L$,105,R$,106,LC$,107,RC$,108,H$,112,L$,113,R$,114,LC$,115,RC$,116,H$)
85 CALL CHAR(120,L$,121,R$,122,LC$,123,RC$,124,H$,128,L$,129,R$,130,LC$,131,RC$,132,H$,136,L$,137,R$,138,LC$,139,RC$,140,H$)
87 CALL CHAR(88,L$,89,R$,90,LC$,91,RC$,92,H$)
90 CC=1 :: C=17
100 !DRAW LEFT SIDE
110 FOR I=10 TO 23
120 CC=CC+1
130 CALL HCHAR(I,C-CC,96)
140 NEXT I
142 CC=1
144 FOR I=11 TO 22
145 CC=CC+1
146 CALL HCHAR(I,C-CC,88)
147 NEXT I
148 CC=1
150 FOR I=12 TO 21
160 CC=CC+1
170 CALL HCHAR(I,C-CC,104)
180 NEXT I
185 CC=1
190 FOR I=13 TO 20
200 CC=CC+1
210 CALL HCHAR(I,C-CC,112)
220 NEXT I
225 CC=1
230 FOR I=14 TO 19
240 CC=CC+1
250 CALL HCHAR(I,C-CC,120)
260 NEXT I
265 CC=1
270 FOR I=15 TO 18
280 CC=CC+1
290 CALL HCHAR(I,C-CC,128)
300 NEXT I
305 CC=1
310 FOR I=16 TO 17
320 CC=CC+1
330 CALL HCHAR(I,C-CC,136)
340 NEXT I
345 CC=1
350 ! *DRAW TRIANGLE BOTTOM*
360 CALL HCHAR(24,2,100,30) :: CALL HCHAR(22,6,108,22) :: CALL HCHAR(21,8,116,18)
370 CALL HCHAR(20,10,124,14) :: CALL HCHAR(19,12,132,10) :: CALL HCHAR(18,14,140,6)
380 CALL HCHAR(23,4,92,26)
390 ! *DRAW CAPS -7 LEFT,7 RIGHT
400 CALL HCHAR(24,1,98) :: CALL HCHAR(24,32,99) :: CALL HCHAR(22,5,106) :: CALL HCHAR(22,28,107)
410 CALL HCHAR(21,7,114) :: CALL HCHAR(21,26,115) :: CALL HCHAR(20,9,122) :: CALL HCHAR(20,24,123)
420 CALL HCHAR(19,11,130) :: CALL HCHAR(19,22,131) :: CALL HCHAR(18,13,138) :: CALL HCHAR(18,20,139)
425 CALL HCHAR(23,3,90) :: CALL HCHAR(23,30,91)
430 CC=0
440 ! *DRAW RIGHT SIDE
450 FOR I=10 TO 23
460 CC=CC+1
470 CALL HCHAR(I,C+CC,97)
480 NEXT I
490 CC=0
500 FOR I=11 TO 22
510 CC=CC+1
520 CALL HCHAR(I,C+CC,89)
530 NEXT I
540 CC=0
550 FOR I=12 TO 21
560 CC=CC+1
570 CALL HCHAR(I,C+CC,105)
580 NEXT I
590 CC=0
600 FOR I=13 TO 20
610 CC=CC+1
620 CALL HCHAR(I,C+CC,113)
630 NEXT I
640 CC=0
650 FOR I=14 TO 19
660 CC=CC+1
670 CALL HCHAR(I,C+CC,121)
680 NEXT I
690 CC=0
700 FOR I=15 TO 18
710 CC=CC+1
720 CALL HCHAR(I,C+CC,129)
730 NEXT I
740 CC=0
750 FOR I=16 TO 17
760 CC=CC+1
780 CALL HCHAR(I,C+CC,137)
790 NEXT I
800 CC=0
810 GOTO 810

post-19460-0-00772700-1329802737_thumb.jpg

Edited by orion1052003
  • Like 1
Link to comment
https://forums.atariage.com/topic/193788-pieces-of-programming/
Share on other sites

  • 2 weeks later...
post-19460-0-50159800-1329802929_thumb.jpgpost-19460-0-62599900-1329802987_thumb.jpg
10 !KNIGHTMOVES-KNIGHTER
40 !KNIGHT MOVES
50 !BY JAMES PEYTON 2012
55 CALL CLEAR :: CALL CHARSET
60 CALL COLOR(9,13,1,10,3,1,11,16,3) :: CALL SCREEN(6)
64 CHESS$="A8B8C8D8E8F8G8H8A7B7C7D7E7F7G7H7A6B6C6D6E6F6G6H6A5B5C5D5E5F5G5H5A4B4C4D4E4F4G4H4A3B3C3D3E3F3G3H3A2B2C2D2E2F2G2H2A1B1C1D1E1F1G1H1"
70 S$="FFFFFFFFFFFFFFFF" :: K$="3A7C6EFFFFCF0F1F3736363636367F7F"
75 D$="FFFFFFFFFFFFFFFF"
80 CALL CHAR(96,S$,104,S$,112,K$,115,D$)
83 CALL CHAR(116,"80C0E0F0F8FCFEF") :: CALL CHAR(117,"0103070F1F3F7FFF")!KNIGHTSYMBOL
85 CALL CHAR(118,"FFFFFFFFFF1F1F1F") :: CALL CHAR(119,"FFFFFFFFFF000000")!KNIGHTSYMBOL
90 !DRAW SQUARES
100 FOR I=1 TO 3 :: FOR J=1 TO 3
120 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
130 NEXT J :: NEXT I
140 FOR I=4 TO 6 :: FOR J=4 TO 6
150 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
160 NEXT J :: NEXT I
170 FOR I=7 TO 9 :: FOR J=1 TO 3
180 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
190 NEXT J :: NEXT I
200 FOR I=10 TO 12 :: FOR J=4 TO 6
210 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
220 NEXT J :: NEXT I
230 FOR I=13 TO 15 :: FOR J=1 TO 3
240 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
250 NEXT J :: NEXT I
260 FOR I=16 TO 18 :: FOR J=4 TO 6
270 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
280 NEXT J :: NEXT I
290 FOR I=19 TO 21 :: FOR J=1 TO 3
300 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
310 NEXT J :: NEXT I
320 FOR I=22 TO 24 :: FOR J=4 TO 6
330 CALL HCHAR(I,J,96) :: CALL HCHAR(I,J+6,96) :: CALL HCHAR(I,J+12,96) :: CALL HCHAR(I,J+18,96)
340 NEXT J :: NEXT I
350 !BOTTOMRIGHTCORNER
360 FOR I=19 TO 24 :: FOR J=25 TO 32
370 CALL HCHAR(I,J,96)
380 NEXT J :: NEXT I
390 !MIDDLERIGHTSIDE
400 FOR I=7 TO 18 :: FOR J=25 TO 32
410 CALL HCHAR(I,J,104)
420 NEXT J :: NEXT I
421 !KNIGHT SYMBOL
422 CALL HCHAR(11,27,115,4) :: CALL HCHAR(12,27,115,2) :: CALL HCHAR(13,28,115,2) :: CALL HCHAR(14,28,115,2)
423 CALL HCHAR(15,27,115,4) :: CALL HCHAR(10,28,115)
424 CALL HCHAR(9,28,116) :: CALL HCHAR(10,27,117) :: CALL HCHAR(10,29,118) :: CALL HCHAR(12,30,119)
429 !STATS DISPLAY
430 DISPLAY AT(20,23):"KNIGHT"
440 DISPLAY AT(22,23):"MOVES"!:: DISPLAY AT(2,28):SQUARE$:: DISPLAY AT(4,28):"OLD"
450 !ISPLAY AT(6,27):"LAST"
480 HR=105 :: HC=105
490 CALL SPRITE(#1,112,16,HR,HC)!KNIGHT-SPRITE
495 !MAIN LOOP
500 CALL JOYST(1,X,Y) :: CALL KEY(1,K,S) :: DR,DC=0
510 CALL POSITION(#1,HR,HC)
520 IF X=0 AND Y=4 THEN DR=HR-48 :: DC=HC-24 :: GOTO 600
530 IF X=4 AND Y=4 THEN DR=HR-48 :: DC=HC+24 :: GOTO 600
540 IF X=4 AND Y=0 THEN DR=HR-24 :: DC=HC+48 :: GOTO 600
550 IF X=4 AND Y=-4 THEN DR=HR+24 :: DC=HC+48 :: GOTO 600
560 IF X=0 AND Y=-4 THEN DR=HR+48 :: DC=HC+24 :: GOTO 600
570 IF X=-4 AND Y=-4 THEN DR=HR+48 :: DC=HC-24 :: GOTO 600
580 IF X=-4 AND Y=0 THEN DR=HR+24 :: DC=HC-48 :: GOTO 600
590 IF X=-4 AND Y=4 THEN DR=HR-24 :: DC=HC-48 :: GOTO 600
600 IF(DR<1 OR DR>192)OR(DC<1 OR DC>192)THEN GOTO 500
610 CALL LOCATE(#1,DR,DC) :: CALL SQUARE(DR,DC,CHESS$)!: DR,DC=0 :: FOR D=1 TO 100 :: NEXT D :: GOTO 500
620 DR,DC=0 :: FOR D=1 TO 100 :: NEXT D :: GOTO 500
700 SUB SQUARE(DR,DC,CHESS$)
710 R=INT((DR+7)/8) :: C=INT((DC+7)/8) :: QR=(R+1)/3 :: QC=(C+1)/3 :: SQ=(QR-1)*8+QC
720 SQUARE$=SEG$(CHESS$,SQ*2-1,2)
725 DISPLAY AT(2,26):SQUARE$
726 DISPLAY AT(3,26):SQ
730 SUBEND

Smaller faster drawing:

 

90 !DRAW SQUARES
100 R=1 :: C=1
110 FOR I=1 TO 8
120 FOR J=1 TO 3
130 CALL HCHAR(R,C,96,3):: CALL HCHAR(R,C+6,96,3):: CALL HCHAR(R,C+12,96,3):: CALL HCHAR(R,C+18,96,3)
140 R=R+1
150 NEXT J
160 IF C=1 THEN C=4 ELSE C=1
170 NEXT I
350 !BOTTOMRIGHTCORNER
360 FOR I=19 TO 24
370 CALL HCHAR(I,25,96,
380 NEXT I
390 !MIDDLERIGHTSIDE
400 FOR I=7 TO 18
410 CALL HCHAR(I,25,104,
420 NEXT I

  • 3 weeks later...

Seems about the same speed wise, compared to the second way, but SO much shorter! Especially than the first one, the one I wrote. Gotta love those relational expressions. Now I just got to break it down. Thanks you guys! The drawing looks much more professional without that LONG wait it used to have in the first program.

The first is a drawing of several pyramid shapes within a larger pyramid. How can the empty spot in the center be programmed to connect?

 

Try this

130 CALL HCHAR(I-1,C-CC+1,96)

 

This is just a hint at where to maybe change things.

Edited by sometimes99er

100 ! RAINBOW PYRAMID
110 CALL SCREEN(2)::CALL CLEAR::CALL COLOR(1,7,1,2,12,1,3,12,1,4,10,1,5,5,1,6,8,1,7,4,1)
120 FOR A=0 TO 7::CALL CHAR(A*8+33,"FF",A*8+34,"01020408102040808040201008040201")
130 CALL HCHAR(24-A,1+A*2,A*8+33,32-A*4)::FOR B=0 TO 15-A*2
140 CALL HCHAR(23-A-B,1+A*2+B,A*8+34)::CALL HCHAR(23-A-B,32-A*2-B,A*8+35)::NEXT B::NEXT A

 

 

This is the FULL Rainbow Pyramid slightly altered. Not that it's better or anything, just different - and a bit smaller.

Edited by sometimes99er

RECTANGLES

 

Since you're teaching me how to make things with less code, how would one shorten this up?

 

Something like Q=34 :: FOR I=1 to 12 :: CALL HCHAR(I,I,?,Q-2) :: NEXT I

Q=8 :: FOR I=13 to 24 :: FOR J=12 TO 1 STEP -1 :: CALL HCHAR(I,J,?,Q+2) :: NEXT J :: NEXT I

I goes from 1-24 and J goes 1 up to 12 and 12 down to 1 again. There are 2 chars alternating in most of the lines. This is concerning only the horizontal (HCHAR) portion, but something similar to the above would be an example for the vertical (VCHAR) part. Even if this works, I have a feeling there is something even shorter.

19 !RECTANGLES-2012 JAMES P
20 CALL COLOR(9,4,4,10,14,14)!GREEN,MAGENTA
30 CALL CHAR(96,"FFFFFFFFFFFFFFFF") :: CALL CHAR(104,"FFFFFFFFFFFFFFFF")
35 !HORIZONTALS
40 CALL HCHAR(1,1,96,32)
50 CALL HCHAR(2,2,104,30)
60 CALL HCHAR(3,3,96,28)
70 CALL HCHAR(4,4,104,26)
80 CALL HCHAR(5,5,96,24)
90 CALL HCHAR(6,6,104,22)
100 CALL HCHAR(7,7,96,20)
110 CALL HCHAR(8,8,104,18)
120 CALL HCHAR(9,9,96,16)
130 CALL HCHAR(10,10,104,14)
140 CALL HCHAR(11,11,96,12)
150 CALL HCHAR(12,12,104,10)
160 CALL HCHAR(13,12,104,10)
170 CALL HCHAR(14,11,96,12)
180 CALL HCHAR(15,10,104,14)
190 CALL HCHAR(16,9,96,16)
200 CALL HCHAR(17,8,104,18)
210 CALL HCHAR(18,7,96,20)
220 CALL HCHAR(19,6,104,22)
230 CALL HCHAR(20,5,96,24)
240 CALL HCHAR(21,4,104,26)
250 CALL HCHAR(22,3,96,28)
260 CALL HCHAR(23,2,104,30)
270 CALL HCHAR(24,1,96,32)
275 !VERTICALS
280 CALL VCHAR(2,1,96,22)
290 CALL VCHAR(3,2,104,20)
300 CALL VCHAR(4,3,96,18)
310 CALL VCHAR(5,4,104,16)
320 CALL VCHAR(6,5,96,14)
330 CALL VCHAR(7,6,104,12)
340 CALL VCHAR(8,7,96,10)
350 CALL VCHAR(9,8,104,
360 CALL VCHAR(10,9,96,6)
370 CALL VCHAR(11,10,104,4)
380 CALL VCHAR(12,11,96,2)
390 CALL VCHAR(12,22,96,2)
400 CALL VCHAR(11,23,104,4)
410 CALL VCHAR(10,24,96,6)
420 CALL VCHAR(9,25,104,
430 CALL VCHAR(8,26,96,10)
440 CALL VCHAR(7,27,104,12)
450 CALL VCHAR(6,28,96,14)
460 CALL VCHAR(5,29,104,16)
470 CALL VCHAR(4,30,96,18)
480 CALL VCHAR(3,31,104,20)
490 CALL VCHAR(2,32,96,22)
500 GOTO 500

post-19460-0-48218700-1332886230_thumb.jpg

A question about loops.

On Knight Moves, I made a title screen. How would you keep the flashing eyes in line 960 and still allow the player to INPUT a value to pass to the next screen?

 

100 !KNIGHTS
110 !KNIGHT MOVES
120 !BY JAMES PEYTON 2012
130 CALL TITLE
140 CALL CLEAR :: CALL CHARSET
150 CALL COLOR(9,13,1,10,3,1,11,16,3) :: CALL SCREEN(6)
160 CHESS$="A8B8C8D8E8F8G8H8A7B7C7D7E7F7G7H7A6B6C6D6E6F6G6H6A5B5C5D5E5F5G5H5A4B4C4D4E4F4G4H4A3B3C3D3E3F3G3H3A2B2C2D2E2F2G2H2A1B1C1D1E1F1G1H1"
170 S$="FFFFFFFFFFFFFFFF" :: K$="3A7C6EFFFFCF0F1F3736363636367F7F"
180 D$="FFFFFFFFFFFFFFFF"
190 CALL CHAR(96,S$,104,S$,112,K$,115,D$)
200 CALL CHAR(116,"80C0E0F0F8FCFEF") :: CALL CHAR(117,"0103070F1F3F7FFF")!KNIGHTSYMBOL
210 CALL CHAR(118,"FFFFFFFFFF1F1F1F") :: CALL CHAR(119,"FFFFFFFFFF000000")!KNIGHT SYMBOL
220 !DRAW SQUARES
230 FOR R=0 TO 7 :: FOR C=(R AND 1)TO 7 STEP 2 :: FOR I=1 TO 3 :: CALL HCHAR(R*3+I,C*3+1,96,3) :: NEXT I :: NEXT C :: NEXT R
240 !KNIGHT SYMBOL
250 CALL HCHAR(11,27,115,4) :: CALL HCHAR(12,27,115,2) :: CALL HCHAR(13,28,115,2) :: CALL HCHAR(14,28,115,2)
260 CALL HCHAR(15,27,115,4) :: CALL HCHAR(10,28,115)
270 CALL HCHAR(9,28,116) :: CALL HCHAR(10,27,117) :: CALL HCHAR(10,29,118) :: CALL HCHAR(12,30,119)
280 !STATS DISPLAY
290 DISPLAY AT(20,23):"KNIGHT"
300 DISPLAY AT(22,23):"MOVES"!:: DISPLAY AT(2,28):SQUARE$:: DISPLAY AT(4,28):"OLD"
310 !ISPLAY AT(6,27):"LAST"
320 HR=105 :: HC=105
330 CALL SPRITE(#1,112,16,HR,HC)!KNIGHT-SPRITE
340 !MAIN LOOP
350 CALL JOYST(1,X,Y) :: CALL KEY(1,K,S) :: DR,DC=0
360 CALL POSITION(#1,HR,HC)
370 IF X=0 AND Y=4 THEN DR=HR-48 :: DC=HC-24 :: GOTO 450
380 IF X=4 AND Y=4 THEN DR=HR-48 :: DC=HC+24 :: GOTO 450
390 IF X=4 AND Y=0 THEN DR=HR-24 :: DC=HC+48 :: GOTO 450
400 IF X=4 AND Y=-4 THEN DR=HR+24 :: DC=HC+48 :: GOTO 450
410 IF X=0 AND Y=-4 THEN DR=HR+48 :: DC=HC+24 :: GOTO 450
420 IF X=-4 AND Y=-4 THEN DR=HR+48 :: DC=HC-24 :: GOTO 450
430 IF X=-4 AND Y=0 THEN DR=HR+24 :: DC=HC-48 :: GOTO 450
440 IF X=-4 AND Y=4 THEN DR=HR-24 :: DC=HC-48 :: GOTO 450
450 IF(DR<1 OR DR>192)OR(DC<1 OR DC>192)THEN GOTO 350
460 CALL LOCATE(#1,DR,DC) :: CALL SQUARE(DR,DC,CHESS$)!: DR,DC=0 :: FOR D=1 TO 100 :: NEXT D :: GOTO 500
470 DR,DC=0 :: FOR D=1 TO 100 :: NEXT D :: GOTO 350
480 SUB SQUARE(DR,DC,CHESS$)
490 R=INT((DR+7)/8) :: C=INT((DC+7)/8) :: QR=(R+1)/3 :: QC=(C+1)/3 :: SQ=(QR-1)*8+QC
500 SQUARE$=SEG$(CHESS$,SQ*2-1,2)
510 DISPLAY AT(2,26):SQUARE$
520 DISPLAY AT(3,26):SQ
530 SUBEND
540 SUB TITLE
550 CALL CLEAR :: CALL COLOR(9,16,2,10,15,2,11,2,15,12,8,8,13,5,5)
555 CALL COLOR(2,2,2)
560 L1$="C0C0C0C0C0C0C0C0" :: L2$="C3C3C3C3C3C3C3C3" :: L3$="0303030303030303"
570 D1$="80C0E0F0F8FCFEFF" :: D2$="0103070F1F3F7FFF" :: D3$="FFFEFCF8F0E0C080" :: D4$="FF7F3F1F0F070301"
580 D5$="FFFEFCF8F8FCFEFF" :: SQ$="FFFFFFFFFFFFFFFF" :: SQG$="FFFFFFFFFFFFFFFF" :: R$="FFFFFFFFFFFFFFFF"
590 CALL COLOR(5,2,3,6,2,3,7,2,3,8,2,3)
600 !D$=DIAGONAL LINES-L$=KNIGHTHEADGRILL
610 CALL CHAR(96,D1$,97,D2$,98,D3$,99,D4$,100,D5$,101,SQ$,112,L1$,113,L2$,114,L3$,104,SQG$)
620 CALL SCREEN(2) :: CALL HCHAR(1,1,120,224) :: CALL HCHAR(22,1,128,96)
621 CALL HCHAR(4,2,101,2)!2 HORSES BACKGROUND
622 CALL HCHAR(2,3,101) :: CALL HCHAR(3,2,101,4) :: CALL HCHAR(5,3,101,2) :: CALL HCHAR(6,3,101,2)
623 CALL HCHAR(7,2,101,4) :: CALL HCHAR(2,29,32) :: CALL HCHAR(3,27,32,4) :: CALL HCHAR(4,29,32,2)
624 CALL HCHAR(5,28,32,2) :: CALL HCHAR(6,28,32,2) :: CALL HCHAR(7,27,32,4)
630 !KNIGHTHEAD SQUARE
640 CALL HCHAR(2,15,104,5) :: CALL HCHAR(3,15,104,5) :: CALL HCHAR(4,15,104,5) :: CALL HCHAR(5,15,104,5)
650 CALL HCHAR(6,15,104,5) :: CALL HCHAR(5,16,112) :: CALL HCHAR(5,17,113) :: CALL HCHAR(5,18,114)
660 CALL HCHAR(3,16,40) :: CALL HCHAR(3,18,40)!EYES
670 !770-800 BOTTOM SQUARES
680 FOR I=22 TO 24 :: FOR J=1 TO 3
690 CALL HCHAR(I,J,101) :: CALL HCHAR(I,J+6,101) :: CALL HCHAR(I,J+12,101) :: CALL HCHAR(I,J+18,101)
700 CALL HCHAR(I,J+24,101) :: NEXT J :: NEXT I
710 FOR I=22 TO 24 :: FOR J=31 TO 32 :: CALL HCHAR(I,J,101) :: NEXT J :: NEXT I
720 DISPLAY AT(23,5):"BY JAMES PEYTON"
730 !KNIGHT 840 - 860 MOVES 870 -
740 CALL VCHAR(9,4,101,5) :: CALL VCHAR(9,9,101,5) :: CALL VCHAR(9,13,101,5) :: CALL VCHAR(9,16,101,5)
750 CALL VCHAR(9,19,101,5) :: CALL VCHAR(9,24,101,5) :: CALL VCHAR(9,26,101,5)
760 CALL VCHAR(9,29,101,5) :: CALL HCHAR(9,15,101,3) :: CALL HCHAR(9,19,101,4) :: CALL HCHAR(9,28,101,3)
770 CALL VCHAR(16,5,101,5) :: CALL VCHAR(16,10,101,5) :: CALL VCHAR(16,12,101,5) :: CALL VCHAR(16,14,101,5)
780 CALL VCHAR(16,25,101,5) :: CALL VCHAR(16,29,101,3) :: CALL VCHAR(18,31,101,3)
790 CALL HCHAR(13,15,101,3) :: CALL HCHAR(13,19,101,4) :: CALL HCHAR(11,21,101) :: CALL HCHAR(11,25,101)
800 CALL VCHAR(11,22,101,2)
810 CALL HCHAR(16,13,101) :: CALL HCHAR(16,26,101,2) :: CALL HCHAR(20,13,101)
820 CALL HCHAR(18,26,101) :: CALL HCHAR(20,26,101,2) :: CALL HCHAR(16,30,101,2) :: CALL HCHAR(18,29,101,2)
830 CALL HCHAR(20,29,101,2)
840 !DIAGONAL LINES
850 CALL HCHAR(9,6,97) :: CALL HCHAR(9,7,98) :: CALL HCHAR(10,5,97) :: CALL HCHAR(10,6,98)
860 CALL HCHAR(11,5,100) :: CALL HCHAR(12,5,99) :: CALL HCHAR(13,6,99) :: CALL HCHAR(13,7,96)
870 CALL HCHAR(16,6,96) :: CALL HCHAR(17,6,101) :: CALL HCHAR(18,6,99) :: CALL HCHAR(17,7,96)
880 CALL HCHAR(18,7,101) :: CALL HCHAR(19,7,99) :: CALL HCHAR(17,8,97) :: CALL HCHAR(18,8,101)
890 CALL HCHAR(19,8,98) :: CALL HCHAR(16,9,97) :: CALL HCHAR(17,9,101) :: CALL HCHAR(18,9,98)
900 CALL HCHAR(10,10,96) :: CALL HCHAR(11,10,99) :: CALL HCHAR(11,11,96) :: CALL HCHAR(12,11,99)
910 CALL HCHAR(12,12,96) :: CALL HCHAR(13,12,99) :: CALL HCHAR(16,16,96) :: CALL HCHAR(17,16,99)
920 CALL HCHAR(17,17,96) :: CALL HCHAR(18,17,99) :: CALL HCHAR(18,18,96) :: CALL HCHAR(19,18,99)
930 CALL HCHAR(19,19,96) :: CALL HCHAR(20,19,99) :: CALL HCHAR(20,20,98)
940 CALL HCHAR(19,20,97) :: CALL HCHAR(19,21,98) :: CALL HCHAR(18,21,97) :: CALL HCHAR(18,22,98)
950 CALL HCHAR(17,22,97) :: CALL HCHAR(17,23,98) :: CALL HCHAR(16,23,97) :: CALL HCHAR(12,6,96)
960 CALL COLOR(2,10,10) :: CALL COLOR(2,2,2)
965 GOTO 960
970 SUBEND

post-19460-0-50522000-1332886690_thumb.jpg

Edited by orion1052003

Trying to understand your shortening.....Does it boil down to some of this?

 

 

R=0 TO 7

 

C=(R AND 1) TO 7 STEP 2

 

I=1 TO 3

 

CALL HCHAR(R * 3+ I, C * 3 + I, 96, 3)

 

NEXT I

NEXT C

NEXT R

 

R C C C C C

0 AND 1= 0 TO 7 STEP 2 0 2 4 6

1 AND 1= 1 TO 7 STEP 2 1 3 5 7

2 AND 1= 0 TO 7 STEP 2 0 2 4 6

3 AND 1= 1 TO 7 STEP 2 1 3 5 7

4 AND 1= 0 TO 7 STEP 2 0 2 4 6

5 AND 1= 1 TO 7 STEP 2 1 3 5 7

6 AND 1= 0 TO 7 STEP 2 0 2 4 6

7 AND 1= 0 TO 7 STEP 2 1 3 5 7

 

90 !DRAW SQUARES
100 FOR R=0 TO 7::FOR C=(R AND 1) TO 7 STEP 2::FOR I=1 TO 3::CALL HCHAR(R*3+I,C*3+1,96,3)::NEXT I::NEXT C::NEXT R

K$="3A7C6EFFFFCF0F1F3736363636367F7F" is the character definition of the Joystick controlled Knight, but only the top half is shown in the game. Any thoughts as to why?

 

3A7C6EFFFFCF0F1F3736363636367F7F

post-19460-0-03844100-1332887719_thumb.jpg

post-19460-0-08862000-1332887804_thumb.jpg

Edited by orion1052003

DISPLAY AT question. (knight moves title screen)

 

 

How do I make DISPLAY AT do what I want? I notice it blanks out everything behind the text. If I CALL COLOR the background of the characters displayed to transparent(color code 1) the foreground or letters will be there but the background drawn behind is blanked out rather than transparently on top another "layer". If you do a CALL SCREEN(2) for example, and have a black background screen…and then draw something on the bottom with CALL CHAR…the the CALL CHAR stuff will be erased but the black background will still be there.

 

So you have a black background.

If you try to put some standard black printed text over a blue lake, for example, you will have the lake, and the text with this big black line around it rather than the blue in the background. And the text will also be invisible since it's black. I guess you could set CALL SCREEN around your text, but that could make the other parts of the screen be more tedious to create. You could also change all the color sets for the letters A-Z to make the letters white on black, but why would you want to do that? To just change the background relative to the foreground would be much simpler if it is possible.

 

It looks like Display At automatically "blanks out" 24 characters in a line. Meaning if you type in "By James Peyton" you have a bunch of extra empty space on the right. As you can see, the background

for letters is green, but character 32 ends up black. Not sure why.

If I remember correctly, use SIZE. So, for example:

 

10 CALL HCHAR(1,1,42,768)
20 A$="BY JAMES PEYTON"
30 DISPLAY AT(10,1):A$
40 DISPLAY AT(12,1)SIZE(LEN(A$)):A$

 

The HCHAR is just to put something on the screen so that you can see the difference between line 30 and 40.

 

Hope this helps.

RECTANGLES

 

Much the same end result ...

 

100 !RECTANGLES
110 CALL CLEAR
120 CALL COLOR(1,4,4,2,14,14)
130 FOR A=2 TO 13 STEP 2
140 CALL HCHAR(A,A,40,34-A*2)
150 CALL VCHAR(A,A,40,26-A*2)
160 CALL HCHAR(25-A,A,40,34-A*2)
170 CALL VCHAR(A,33-A,40,26-A*2)
180 NEXT A
190 GOTO 190

RECTANGLES

 

Another approach ...

 

100 !RECTANGLES
110 CALL COLOR(9,4,4,10,14,14)
120 FOR A=1 TO 23
130 CALL HCHAR(A,A-(A>12)*(24-A*2),96+(A AND 1)*8,34-A*2-(A>12)*(A-12)*4)
140 CALL VCHAR(A+(A>12)*(A-12)*2,A-(A>12)*9,96+(A AND 1)*8,24-A*2-(A>12)*(A-12)*4)
150 NEXT A
160 GOTO 160

How would you keep the flashing eyes in line 960 and still allow the player to INPUT a value to pass to the next screen?

 

960 CALL COLOR(2,10,10)::CALL KEY(1,K,S)::CALL COLOR(2,2,2)
965 IF S=0 THEN 960

Edited by sometimes99er

Trying to understand your shortening.....Does it boil down to some of this?

 

Yes, I think that's about the same. Basically I pretty much start out with what you do, maybe slightly more loop based, but simple without any shaggy math. Then I try and think out of the box and see patterns, lines/code that could be reused and/or compressed. I might even try out an idea, and then go back to a working solution before attempting outer solutions. Only at the final stage do I go for multiple statements on a line.

 

90 !DRAW SQUARES
100 FOR R=0 TO 7
110 FOR C=(R AND 1) TO 7 STEP 2
120 FOR I=1 TO 3
130 PRINT "R=";R;" C=";C;" I=";I
140 NEXT I
150 NEXT C
160 NEXT R

Edited by sometimes99er

I mean does this statement you made work out to the above post when the computer evaluates it? I didn't fully write it out, but I guess it would have to make all the same HCHAR and VCHAR coordinates when written out on paper. Trying to understand the logical expressions and how they work. They are neat!

 

90 !DRAW SQUARES

100 FOR R=0 TO 7::FOR C=(R AND 1) TO 7 STEP 2::FOR I=1 TO 3::CALL HCHAR(R*3+I,C*3+1,96,3)::NEXT I::NEXT C::NEXT R

  • Like 1

I mean does this statement you made work out to the above post when the computer evaluates it? I didn't fully write it out, but I guess it would have to make all the same HCHAR and VCHAR coordinates when written out on paper. Trying to understand the logical expressions and how they work. They are neat!

 

90 !DRAW SQUARES

100 FOR R=0 TO 7::FOR C=(R AND 1) TO 7 STEP 2::FOR I=1 TO 3::CALL HCHAR(R*3+I,C*3+1,96,3)::NEXT I::NEXT C::NEXT R

 

"R AND 1" does a bitwise "AND" of R and 1 represented in binary. The answer will alternate between 0 and 1 because every other value of R has a 1 in the lowest bit and the rest do not. The result is that C in the "FOR C ... NEXT C" loop will alternate between the even series (0,2,4,6) and the odd series (1,3,5,7).

 

...lee

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...