Jump to content
Sign in to follow this  
tibasic

TI Basic game: H Fighter

Recommended Posts

Hi,

 

It's been a while since I've written any basic games. This one is a short and simple game inspired by the 1983 Atari Star Wars arcade game. In this game you battle H fighters which are tie fighter-like ships. There is no trench run but I think it's possible to approximate. I might look into if as a separate game. I'm trying to keep my games simple these days.

 

To score against the h fighters your laser needs to strike them in the centre. In a similar manner for the h fighter to score against you and destroy one of your 5 ships it needs to strike you when it is positioned midway horizontally. The h fighter turns magenta just before it fires its laser. In that way you will hopefully have enough time to manoeuvre out of the way. The keys are ESDX for manoeuvring and spacebar to fire.

 

The code is in the spoiler and a file for use with Classic99 is attached.

 

Spoiler


100 CALL CLEAR
110 PRINT "         H-FIGHTER"
120 PRINT
130 PRINT "H shaped space fighters"
140 PRINT "fill up your screen and"
150 PRINT "fire their lasers at you"
160 PRINT "avoid them and fire back"
170 PRINT "with your own lasers"
180 PRINT "your score will be printed"
190 PRINT "when 5 of your ships have"
200 PRINT "been destroyed"
210 PRINT "score 10 points by shooting"
220 PRINT "at the centre of a h fighter"
230 PRINT
240 PRINT "keys:"
250 PRINT "E up":"X down":"S left":"D right":"SPACE fire":::
260 PRINT "   PRESS ANY KEY TO PLAY"
270 CALL KEY(0,K,S)
280 IF S=0 THEN 270
290 REM  initialise
300 T=1
310 X=16
320 Y=0
330 LV=5
340 SC=0
350 REM  chars and colours
360 CALL CHAR(128,"00003C3C3C3C0000")
370 CALL CHAR(129,"0000FFFFFFFF0000")
380 CALL CHAR(136,"0000FF0000FF0000")
390 CALL CHAR(144,"C3C3C3C3C3C3C3C3")
400 CALL SCREEN(2)
410 CALL COLOR(13,3,1)
420 CALL COLOR(14,6,1)
430 CALL COLOR(15,7,1)
440 REM  start game
450 CALL KEY(0,K,S)
460 IF S=0 THEN 660
470 IF K<>32 THEN 610
480 REM  player shoots
490 FOR I=0 TO 2
500 CALL HCHAR(12,I*5+2,136,5)
510 CALL HCHAR(12,26-I*5,136,5)
520 NEXT I
530 IF (Y=0)*(X<19)*(X>14)THEN 550 ELSE 610
540 REM  player scores
550 CALL SOUND(300,800,0)
560 CALL SCREEN(16)
570 CALL SCREEN(2)
580 SC=SC+10
590 T=11
600 GOTO 900
610 X=X-(K=68)
620 X=X+(K=83)
630 Y=Y-(K=88)
640 Y=Y+(K=69)
650 IF (X+T>32)+(X-T<1)+(12+Y-T<2)THEN 910 ELSE 660
660 CALL CLEAR
670 REM  move h fighter
680 T2=T*2
690 CALL VCHAR(12+Y-0.5*T2,X+T,128,T2)
700 CALL VCHAR(12+Y-0.5*T2,X-T,128,T2)
710 CALL HCHAR(12+Y,X-T+1,129,T2-1)
720 IF (RND>0.8)*(FLAG=0)THEN 740 ELSE 760
730 REM  prepare to fire
740 CALL COLOR(13,14,1)
750 FLAG=1
760 IF (RND>0.7)*(FLAG=1)THEN 780 ELSE 890
770 REM  h fighter fires
780 CALL VCHAR(12+Y+1,X,144,11-Y)
790 CALL COLOR(13,3,1)
800 FLAG=0
810 IF (X>13)*(X<19)THEN 830 ELSE 890
820 REM  h fighter scores
830 LV=LV-1
840 CALL SOUND(300,110,0)
850 CALL SCREEN(3)
860 CALL SCREEN(2)
870 IF LV=0 THEN 960
880 REM  increment counter
890 T=T+1
900 IF T<=10 THEN 940
910 T=1
920 X=10+INT(RND*12)
930 Y=-6+INT(RND*12)
940 GOTO 450
950 REM  game over
960 CALL CLEAR
970 CALL SCREEN(4)
980 PRINT "SCORE:";SC:::
990 PRINT "PLAY AGAIN (Y/N)?"
1000 CALL KEY(0,K,S)
1010 IF S=0 THEN 1000
1020 IF K=89 THEN 300
1030 IF K=78 THEN 1050
1040 GOTO 1000
1050 END

 

 

HFIGHTER.zip

Edited by tibasic
  • Like 10

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.

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...