Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Builderboy on June 11, 2009, 05:43:42 pm

Title: BBC Basic Tetris
Post by: Builderboy on June 11, 2009, 05:43:42 pm
Its the first game for the BBC Basic series!  And its fast enough to compete with assembly!  Look at all its majesty!

(http://i199.photobucket.com/albums/aa72/builderboy2005/SCREENSHOT-1.gif?t=1244756544)

:D  its pending in TiCalc as i speak!
EDIT: Its done!  That was fast:  http://www.ticalc.org/archives/files/fileinfo/419/41980.html

It supports pausing, a nice scoring system, and the speed increases as your score increases!
Title: Re: BBC Basic Tetris
Post by: Geno on June 11, 2009, 06:00:39 pm
Congrats on the first BBC Basic game!  It looks quite good, and I'm sure it was a lot of work.  Does it have any features or options?  Or is it just a simple game?  Also I'll try it when my calc finishes backing up, so I suppose i will soon see.  ;)
Title: Re: BBC Basic Tetris
Post by: Geekboy1011 on June 11, 2009, 06:04:15 pm
thats just plain cool
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 11, 2009, 06:11:14 pm
No menu, and no highscore until i can figure out how to edit appvars.  But you progress through different 'levels' as the game gats faster and faster.  if you manage to survive the fastest level (impossible) you get rewarded beyond your wildest imagination! ;)
Title: Re: BBC Basic Tetris
Post by: nitacku on June 11, 2009, 06:39:37 pm
nice! I'm inspired to port some of my games to bbc now ^_^

I wonder how grayscale would look in bbc....
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 11, 2009, 06:41:19 pm
well, its got an inline assembler, so anythings possible! :)
What kind of games were you thinking of?
Title: Re: BBC Basic Tetris
Post by: Eeems on June 11, 2009, 07:47:58 pm
wow that's amazing! maybe I should take another stab at BBC BASIC....
Title: Re: BBC Basic Tetris
Post by: simplethinker on June 11, 2009, 08:30:50 pm
It looks great Builderboy!  Now I'm tempted to try out BBC Basic...
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on June 11, 2009, 11:31:09 pm
wow friggin awesome, I need to try messing around with BBC basic one day.
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 11, 2009, 11:33:54 pm
lol, thanks!  Everybody's like "i should learn that... someday..."  ;D
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on June 11, 2009, 11:51:57 pm
my only gripe with it tho is that i mostly am into rpg making, and making a rpg with this would prbly require me to split it into 30 password-protected chapters
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 12, 2009, 12:48:24 pm
Yeah, BBC Basic programs have an unnaturaly small maximum file size

And TiCalc processed the game! (fast too)
I added a link to it in the first post.
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on June 12, 2009, 05:44:14 pm
Yeah with Allynfolksjr and Travis as ticalc staff (I do know Allynfolksjr was friggin fast when he did Calcg.org archiving. I am unsure if he's the most active of the two ticalc archiver, though, at the moment) it helps a lot. before they got hired it took 2 months sometimes for files to be processed x.x

We have never hit 1378 files in the pending queue again at that time, though, like in 2002
Title: Re: BBC Basic Tetris
Post by: TravisE on June 14, 2009, 07:19:17 am
I processed that file. :) I think it's notable, so I pointed it out to some other staff members. However, I think they're extremely busy, as I haven't seen much of them lately.
Title: Re: BBC Basic Tetris
Post by: JonimusPrime on June 14, 2009, 03:14:25 pm
How are you drawing the pieces? Would it be possible for you to post your code for us to see, I've played around with BCC basic a little but I haven't finished any of my projects for it yet. Oh and also bbc Basic may have a smaller file size limit but the programs are also more space efficient than TI-Basic ones. Specking of which someone should make an editor for the programs so you don't have to keep using L.# statements to see what you have so far.
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 14, 2009, 04:37:06 pm
Ok, here's the code, although it is kinda big, and i don't know how to put it in one of those scrolling box things

Code: [Select]
  10 VDU 5
   20 R%=0:NOW%=0:NEX%=RND(7)
   30 PROC_PIECE
   40 S%=0:LVL%=14:LS%=0
   50 C%=0:HIT%=FALSE
   60 X%=44:Z%=52
   70 *FX 4,1
   80 *FX 12,1
   90 *FX 11,15
  100 *GSCALE1
  110 *REFRESH OFF
  120 GCOL0:VDU5:CLG:CLS:MOVE 1,20:PRINT " "
  130 RECTANGLE 0,0,95,3:RECTANGLE 24,0,3,64:RECTANGLE 68,0,3,64
  150 PROC_NEW
  160 GCOL4,0
  170 REPEAT
  180   PROC_DISP
  190   *REFRESH
  200   PROC_DISP
  210   C%=C%+1
  220   A%=0
  230   IF C% MOD LVL% = 0:Z%=Z%-4
  240   KEY%=INKEY(0)
  250   IF KEY%=136:X%=X%-4
  260   IF KEY%=137:X%=X%+4
  270   IF INKEY(-42):C%=-1
  280   IF KEY%=139:PROC_ROTL
  290   PROC_HIT
  300 UNTIL HIT% OR KEY%=27 OR KEY%=127
  310 IF KEY%=136:X%=X%+4
  320 IF KEY%=139 PROC_ROTR
  330 IF KEY%=137:X%=X%-4
  340 PROC_HIT
  350 IF HIT% Z%=Z%+4:PROC_DISP:PROC_LINE:PROC_NEW
  360 IF KEY%=27 PROC_END
  370 IF KEY%=127 PROC_PAUSE
  380 GOTO 160
  390 DEFPROC_PAUSE
  400 RECTANGLE FILL 0,0,96,64:*REFRESH
  410 WAIT20
  420 REPEAT UNTIL INKEY(1)>0
  430 RECTANGLE FILL 0,0,96,64
  440 ENDPROC
  450 DEFPROC_NEW                                       //Creates a new piece and updates the screen
  460 NOW%=NEX%:NEX%=RND(7)
  470 X%=44:Z%=56
  480 R%=NOW%
  490 PROC_PIECE:PROC_HIT
  500 IF HIT% PROC_END
  510 GCOLLVL%:RECTANGLE FILL 0,4,23,57:RECTANGLE FILL 72,4,23,57:GCOL15:RECTANGLE FILL 0,20,23,24:GCOL4,0
  520 GCOL15:RECTANGLE FILL 0,57,23,9:RECTANGLE FILL 72,57,23,9:GCOL0:MOVE 1,62:PRINT ;S%:MOVE 73,62:PRINT ;LS%:GCOL4,0
  530 R%=NEX%:X%=8:Z%=30:PROC_PIECE:PROC_DISP
  540 R%=NOW%:PROC_PIECE
  550 X%=44:Z%=56
  560 ENDPROC
  570 DEFPROC_DISP                                           //Displays the current piece at location X,Z
  580 RECTANGLE FILL D%+X%,I%+Z%,3
  590 RECTANGLE FILL E%+X%,J%+Z%,3
  600 RECTANGLE FILL F%+X%,K%+Z%,3
  610 RECTANGLE FILL G%+X%,L%+Z%,3
  620 ENDPROC
  630 DEFPROC_HIT                                              //Detects whether the current piece is hitting anything
  640 HIT%= (POINT(D%+X%,I%+Z%)=0) OR (POINT(E%+X%,J%+Z%)=0) OR (POINT(F%+X%,K%+Z%)=0) OR (POINT(G%+X%,L%+Z%)=0)
  650 ENDPROC
  660 DEFPROC_ROTR                              //Rotates the piece right
  670 B%=D%
  680 D%=-I%
  690 I%=B%
  700 B%=E%
  710 E%=-J%
  720 J%=B%
  730 B%=F%
  740 F%=-K%
  750 K%=B%
  760 B%=G%
  770 G%=-L%
  780 L%=B%
  790 ENDPROC
  800 DEFPROC_ROTL                   Rotates the piece left
  810 B%=-D%
  820 D%=I%
  830 I%=B%
  840 B%=-E%
  850 E%=J%
  860 J%=B%
  870 B%=-F%
  880 F%=K%
  890 K%=B%
  900 B%=-G%
  910 G%=L%
  920 L%=B%
  930 ENDPROC
  940 DEFPROC_PIECE                                                       //creates a new piece based on R%
  950 D%=0:E%=0:F%=0:G%=0:I%=0:J%=0:K%=0:L%=0
  960 IF R%=1 I%=4:K%=-4:L%=-8
  970 IF R%=2 D%=-4:F%=4:L%=4
  980 IF R%=3 D%=-4:I%=-4:J%=-4:L%=4
  990 IF R%=4 D%=-4:I%=4:J%=4:L%=-4
 1000 IF R%=5 D%=-4:G%=4:K%=4:L%=4
 1010 IF R%=6 D%=4:G%=-4:K%=4:L%=4
 1020 IF R%=7 F%=4:G%=4:J%=4:L%=4
 1030 ENDPROC
 1040 DEFPROC_LINE                                  //the beginning of the line checking algorithem
 1050 LIN%=-20
 1060 IF J%+Z%>LIN%:LIN%=J%+Z%
 1070 IF I%+Z%>LIN%:LIN%=I%+Z%
 1080 IF K%+Z%>LIN%:LIN%=K%+Z%
 1090 IF L%+Z%>LIN%:LIN%=L%+Z%
 1100 T%=0
 1110 FOR G%=LIN% TO LIN%-16 STEP -4
 1120   LIN%=G%:IF LIN%>0 PROC_CHECK
 1130 NEXT
 1140 S%=S%+(T%*5)^2
 1150 LS%=LS%+T%
 1160 LVL%=14.999-S%/500
 1170 ENDPROC
 1180 DEFPROC_CHECK                               //checks to see if the current line is full
 1190 B%=0
 1200 FOR F%=28 TO 64 STEP 4
 1210   IF 0=POINT(F%,LIN%) B%=B%+1
 1220 NEXT
 1230 IF B%=10 PROC_REM:T%=T%+1
 1240 ENDPROC
 1250 DEFPROC_REM                                                  //removes a full line and shifts the rest of the screen down
 1260 GCOL15:RECTANGLE FILL 28,LIN%,39,3:GCOL4,0
 1270 REPEAT
 1280   C%=0:LIN%=LIN%+4
 1290   FOR F%=28 TO 64 STEP 4
 1300     IF 0=POINT(F%,LIN%) C%=C%+1:RECTANGLE FILL F%,LIN%-4,3,7
 1310   NEXT
 1320 UNTIL  C%=0
 1330 ENDPROC
 1340 DEFPROC_END            //ends the program and re-sets all the variables
 1350 GCOL0
 1360 *FX4,0
 1370 *FX11,30
 1380 *FX12,10
 1390 CLG:CLS
 1400 *REFRESH ON
 1410 VDU 4

I use a lot of RECTANGLE FILL methods to draw things
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on June 14, 2009, 07:43:14 pm
for code boxes you use [ c o d e ] [ / c o d e ] (without the spaces)
Title: Re: BBC Basic Tetris
Post by: Builderboy on June 14, 2009, 07:56:04 pm
Ah, thank you!  I changed it
Title: Re: BBC Basic Tetris
Post by: Ti-newb on June 16, 2009, 09:41:32 am
Wow, Nice game. I didn't know what BBC Basic was.. and now i do.. (it looks very different then Ti-basic)
Title: Re: BBC Basic Tetris
Post by: Builderboy on August 16, 2009, 10:10:46 pm
Hooray! Tetris has been featured on TiCalc!  Thanks to Duncan for the feature and the rest of the community too!
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on August 16, 2009, 11:23:51 pm
wow congrats for the feature! i really need to try bbc basic at one point. Hopefully this should be a good alternative to BASIC for arcade games or chapter-based RPGs
Title: Re: BBC Basic Tetris
Post by: Builderboy on August 17, 2009, 12:40:22 am
Yeah, you might be able to get around the file size limitation by hosting data in apvars or something.  But its really nice for making arcade games I've discovered :)
Title: Re: BBC Basic Tetris
Post by: simplethinker on August 17, 2009, 12:53:11 pm
Congrats Builderboy!
Title: Re: BBC Basic Tetris
Post by: 3.1415926535 on August 17, 2009, 06:50:46 pm
is BBC basic a realistic language for a beginner like me?
Title: Re: BBC Basic Tetris
Post by: TravisE on August 17, 2009, 06:54:01 pm
I think so. BASIC was meant to be an easy-to-learn language (since it stands for "Beginner's All-purpose Symbolic Instruction Code"). It's not the same as TI-BASIC, but BASIC variants are generally about as easy to learn.
Title: Re: BBC Basic Tetris
Post by: Eeems on August 17, 2009, 07:42:45 pm
well BBC basic isn't as basic as basic... it gets harder and more in depth
Title: Re: BBC Basic Tetris
Post by: miotatsu on August 17, 2009, 09:05:58 pm
is there a good tutorial on it?
Title: Re: BBC Basic Tetris
Post by: Eeems on August 17, 2009, 09:25:07 pm
not that I know of
Title: Re: BBC Basic Tetris
Post by: miotatsu on August 17, 2009, 09:53:40 pm
i gave it a look, this helps: http://www.compulink.co.uk/~rrussell/bbcwin/tutorial/chapter01.html
Title: Re: BBC Basic Tetris
Post by: DJ Omnimaga on August 17, 2009, 11:18:42 pm
i think this language is harder than TI-BASIC because it date back in the early '80s, when almost everything was still done with assembly mostly
Title: Re: BBC Basic Tetris
Post by: Builderboy on August 18, 2009, 12:44:38 am
It is a bit harder in some ways, but it is also easier because it works a lot more like regular programing languages.
Like, for assignments, instead of doing 5->A, you would do A=5

The worst think in BBC Basic is the horrible User Interface IMHO.  It makes it very difficult to visualize and edit code, and is very confusing for beginners.  You have to have a good idea of what your entire game is going to look like code-wise before you're going to code it (this does not apply if your using the on computer file editor, which runs like a normal program text editor).

It does have some very usefull graphics features though, like rectangle draw, fill, and different 'colors' (gradient levels).  Also it has line drawing, pixelTest, and floodfill.  You can also redefine character images to get an easy way to do sprites.  Supports AND/OR/XOR logic for all draw features as well.