03-23-2004, 08:47 PM
I come from Spaghetti realms as well, I coded in my ZX Spectrum from 1988 to 1993. I can read Aga's code as well and I think he's one of the best coders here, as well. But I could change my mind and benefit from the advantages that procedural approaches have over line_numbers-GOTO'ed-GOSUB'ed-non_block_IF'ed-etc approaches
This is code from a ZX Spectrum game I was coding this summer: this moves the enemies
That's Spaghetti, kiddo
It's better to go procedural/structured 'cause it is easier to understand other languages, not just BASIC.
This is code from a ZX Spectrum game I was coding this summer: this moves the enemies
Code:
2000 REM selectGFX
2010 LET aa=PEEK (dir+6): GO SUB 930
2015 IF PEEK (dir+7)=0 THEN GO TO 2050: REM left
2025 IF PEEK (dir+4)=1 THEN GO TO 2040
2030 IF p THEN LET f$="./": GO TO 2032
2031 LET f$="01"
2032 LET e$=",-": RETURN
2040 IF p THEN LET f$=":;": GO TO 2042
2041 LET f$="<="
2042 LET e$="89": RETURN
2050 IF PEEK (dir+4)=1 THEN GO TO 2070
2060 IF p THEN LET f$="45": GO TO 2062
2061 LET f$="67"
2062 LET e$="23": RETURN
2070 IF p THEN LET f$="@A": GO TO 2072
2071 LET f$="BC"
2072 LET e$=">?": RETURN
2100 REM ENEMIGOS-MOVER
2110 FOR i=1 TO 2
2111 LET dir=benem+16*px+80*py+(i-1)*8
2120 GO SUB 2000: REM selectGFX
2132 LET old=PEEK (dir+6)
2140 POKE dir+6,PEEK (dir+6)+PEEK (dir+7)-1
2150 IF PEEK (dir+6)=PEEK (dir+1) OR PEEK (dir+6)=PEEK (dir+2) THEN POKE dir+7, 1-(PEEK (dir+7)-1)
2155 IF PEEK dir THEN GO TO 2200
2157 REM HORIZONTAL
2160 IF old<PEEK (dir+6) THEN PRINT PAPER ps; INK is;AT PEEK (dir+3)-1,PEEK (dir+6)-1;"a"; INK PEEK (dir+5);e$;AT PEEK (dir+3),PEEK (dir+6)-1; INK is;"a"; INK PEEK (dir+5);f$: GO TO 2180
2170 PRINT PAPER ps; INK PEEK (dir+5);AT PEEK (dir+3)-1,PEEK (dir+6);e$; INK is;"a"; INK PEEK (dir+5);AT PEEK (dir+3),PEEK (dir+6);f$; INK is;"a"
2180 IF PEEK (dir+6)>=a-1 AND PEEK (dir+6)<=a+1 AND PEEK (dir+3)>=w-1 AND PEEK (dir+3)<=w+1 THEN LET vi=vi-1: GO SUB 701
2181 GO TO 2300
2200 REM VERTICAL
2210 IF old<PEEK (dir+6) THEN PRINT PAPER ps;AT PEEK (dir+6)-2,PEEK (dir+3); INK is;"aa"; INK PEEK (dir+5);AT PEEK (dir+6)-1,PEEK (dir+3);e$;AT PEEK (dir+6),PEEK (dir+3);f$: GO TO 2230
2220 PRINT PAPER ps;AT PEEK (dir+6)+1,PEEK (dir+3); INK is;"aa"; INK PEEK (dir+5);AT PEEK (dir+6)-1,PEEK (dir+3);e$;AT PEEK (dir+6),PEEK (dir+3);f$
2230 IF PEEK (dir+6)>=w-1 AND PEEK (dir+6)<=w+1 AND PEEK (dir+3)>=a-1 AND PEEK (dir+3)<=a+1 THEN LET vi=vi-1: GO SUB 701
2300 NEXT i
2301 RETURN
That's Spaghetti, kiddo
It's better to go procedural/structured 'cause it is easier to understand other languages, not just BASIC.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i