Jump to content
Sign in to follow this  
tibasic

New TI Basic game demo: Square War

Recommended Posts

Hello,

 

It's been a little while since I've developed a full game as I've been experimenting with writing more simple games. I have attached a demo of a simple game that I started several months ago and recently managed to complete more or less called Square War! One file I saved in the Classic99 format (SQUAREDEMO) and the other is a .dsk file (SQUAREDEMO_dsk). I've also included the listing below in the spoiler. It might be easier to copy and past it into an emulator to try it.

 

I have been trying to write games over the last few months in the spirit of the Texas Program Book 35 programs for home, educational and business use with the TI99/4A by Vince Apps. The Texas Program Book was my favourite TI programming book, apart from the TI manual itself. I remember the programs being easy to type in, consistently mediocre, and simple to understand. Also I don't think I had to debug any of the programs.

 

This game is an Invaders type game except you don't shoot the invader you shoot the colourful blocks behind it which is the source of all its power! To destroy a segment of the block you have to wait until your square is the same colour as the invader's block. You score 10 points once you have destroyed one whole block. The game ends once you have lost three lives or the invader makes it to the bottom of the screen. The keys are S left and D right and space bar to fire. Different levels are not available yet and I need to refine the game a little more too.

 

 

 

Spoiler
100 REM    
110 REM  SQUARE WAR 
120 REM    
130 REM  INITIALISATION  
140 REM  
150 CALL CLEAR
160 PRINT "    S Q U A R E   W A R !":::::::::::
170 PRINT "  press any square to begin":::
180 CALL KEY(0,K,S)
190 IF S=0 THEN 180
200 PRINT ::::::::::::::::::::::::
210 FREQ=20
220 RANDOMIZE
230 X=15
240 Y2=5
250 X2=10
260 OLDY2=5
270 OLDX2=10
280 FIRE=0
290 ADV=0
300 OLDX=15
310 C=2
320 CH=0
330 SHIPS=3
340 DIM A(14)
350 PRINT "DEFINING CHARS ..."
360 CALL CHAR(33,"0F0F0F0FF0F0F0F0")
370 CALL CHAR(34,"F0F0F0F00F0F0F0F")
380 CALL CHAR(35,"00003C3C3C3C0000")
390 CALL CHAR(40,"007E7E7E7E7E7E00")
400 CALL CHAR(41,"E7E7E70000E7E7E7")
410 FOR I=10 TO 16
420 CALL CHAR(I*8+24,"FFFFFFFFFFFFFFFF")
430 CALL CHAR(I*8+25,"FFFFFFFFFFFFFFFF")
440 CALL CHAR(I*8+26,"FFFFFFFFFFFFFFFF")
450 CALL CHAR(I*8+27,"FFFFFFFFFFFFFFFF")
460 CALL CHAR(I*8+28,"0000000000000000")
470 CALL CHAR(I*8+29,"0000000000000000")
480 CALL CHAR(I*8+30,"0000000000000000")
490 CALL CHAR(I*8+31,"0000000000000000")
500 NEXT I
510 PRINT "SETTING COLOURS ..."
520 J=1
530 FOR I=10 TO 16
540 A(J)=INT(RND*14)+2.4
550 IF (A(J)=8.4)+(A(J)>16.4)THEN 540
560 A(J+1)=INT(RND*14)+2.4
570 IF (A(J+1)=8.4)+(A(J+1)>16.4)THEN 560
580 CALL COLOR(I,A(J),A(J+1))
590 J=J+2
600 NEXT I
610 CALL CLEAR
620 CALL SCREEN(8)
630 J=2
640 K=10
650 FOR I=3 TO 29 STEP 4
660 CALL HCHAR(J,I+1,K*8+24)
670 CALL HCHAR(J,I,K*8+25)
680 CALL HCHAR(J+1,I+1,K*8+26)
690 CALL HCHAR(J+1,I,K*8+27)
700 CALL HCHAR(J,I+3,K*8+28)
710 CALL HCHAR(J,I+2,K*8+29)
720 CALL HCHAR(J+1,I+3,K*8+30)
730 CALL HCHAR(J+1,I+2,K*8+31)
740 K=K+1
750 NEXT I
760 A$="LIVES:3 LEVEL:1 SCORE:00000"
770 XTXT=3
780 YTXT=1
790 GOSUB 1800
800 A$="SQUARE WAR"
810 XTXT=11
820 YTXT=9
830 GOSUB 1800
840 A$="FOR THE TI99/4A"
850 XTXT=8
860 YTXT=15
870 GOSUB 1800
880 YTXT=1
890 CALL HCHAR(23,X,40)
900 REM  ************ 
910 REM  *START GAME* 
920 REM  ************ 
930 CALL KEY(0,K,S)
940 T=T+1
950 IF S=0 THEN 1350
960 REM  ************** 
970 REM  *PLAYER FIRES* 
980 REM  ************** 
990 IF K=32 THEN 1000 ELSE 1260
1000 CALL SOUND(300,-5,0)
1010 FOR I=22 TO 6 STEP -4
1020 CALL HCHAR(I,X,41)
1030 CALL HCHAR(I,X,32)
1040 NEXT I
1050 J=INT((X-1)/2)
1060 IF C<>INT(A(INT((X-1)/2)))THEN 1260
1070 N=5-INT((A(J)-INT(A(J)))*10)
1080 ON N GOTO 1120,1110,1100,1090,1260
1090 CALL HCHAR(2,INT((X-1)/2)*2+2,32)
1100 CALL HCHAR(2,INT((X-1)/2)*2+1,32)
1110 CALL HCHAR(3,INT((X-1)/2)*2+2,32)
1120 CALL HCHAR(3,INT((X-1)/2)*2+1,32)
1130 A(J)=A(J)-0.1
1140 CALL SOUND(300,500,0)
1150 IF (A(J)-INT(A(J)))=0 THEN 1160 ELSE 1260
1160 CALL SOUND(300,1000,0)
1170 SC=SC+10
1180 XTXT=30-LEN(STR$(SC))
1190 A$=STR$(SC)
1200 GOSUB 1800
1210 IF SC=10 THEN 1220 ELSE 1260
1220 GOSUB 1850
1230 REM  *************  
1240 REM  *MOVE PLAYER*  
1250 REM  *************  
1260 X=X-(K=ASC("S"))*(X>1)*2+(K=ASC("D"))*(X<29)*2
1270 CALL HCHAR(23,OLDX,32)
1280 CALL HCHAR(23,X,40)
1290 OLDX=X
1300 CALL HCHAR(Y2,X2,33+CH)
1310 CH=CH+(CH=1)-(CH=0)
1320 REM  ************* 
1330 REM  *ENEMY FIRES* 
1340 REM  ************* 
1350 IF FIRE=FREQ THEN 1360 ELSE 1590
1360 CALL SOUND(300,-6,0)
1370 FOR I=Y2+1 TO 22 STEP 2
1380 CALL VCHAR(I,X2,35)
1390 CALL VCHAR(I,X2,32)
1400 NEXT I
1410 IF X2=X THEN 1420 ELSE 1460
1420 CALL SOUND(300,110,0)
1430 SHIPS=SHIPS-1
1440 IF SHIPS=0 THEN 1730
1450 CALL HCHAR(1,9,48+SHIPS)
1460 CALL HCHAR(OLDY2,OLDX2,32)
1470 X2=INT(5*RND)+X
1480 X2=-X2*(X2<=32)-X*(X2>32)
1490 IF ADV=FREQ THEN 1500 ELSE 1530
1500 Y2=Y2+2
1510 IF Y2>=23 THEN 1730
1520 ADV=0
1530 CALL HCHAR(Y2,X2,33+CH)
1540 CH=CH+(CH=1)-(CH=0)
1550 OLDX2=X2
1560 OLDY2=Y2
1570 FIRE=0
1580 ADV=ADV+1
1590 FIRE=FIRE+1
1600 REM  *************** 
1610 REM  *CHANGE COLOUR* 
1620 REM  *************** 
1630 IF NEWC=FREQ THEN 1640 ELSE 1680
1640 C=INT(RND*14)+2
1650 IF C=8 THEN 1640
1660 NEWC=0
1670 CALL COLOR(2,C,1)
1680 NEWC=NEWC+1
1690 GOTO 930
1700 REM  *********** 
1710 REM  *GAME OVER* 
1720 REM  *********** 
1730 CALL CLEAR
1740 PRINT "GAME OVER"::
1750 PRINT "SCORE:";SC
1760 END
1770 REM  ***************** 
1780 REM  *MESSAGE ROUTINE* 
1790 REM  ***************** 
1800 FOR I=1 TO LEN(A$)
1810 CALL HCHAR(YTXT,XTXT,ASC(SEG$(A$,I,1)))
1820 XTXT=XTXT+1
1830 NEXT I
1840 RETURN
1850 CALL HCHAR(9,1,32,32)
1860 CALL HCHAR(15,1,32,32)
1870 A$="WELL DONE"
1880 XTXT=11
1890 YTXT=9
1900 GOSUB 1800
1910 A$="PLEASE CONTINUE"
1920 XTXT=8
1930 YTXT=15
1940 GOSUB 1800
1950 YTXT=1
1960 CALL HCHAR(9,1,32,32)
1970 CALL HCHAR(15,1,32,32)
1980 RETURN

 

 

 

js99er-20200813144910.png

SQUAREDEMO.zip SQUAREDEMO_dsk.zip

  • Like 5

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...