Jump to content
IGNORED

Cargo Lander


tibasic

Recommended Posts

Here's a lunar lander type game. It's taken a couple of years to finish it because it got a bit too complex but I picked it up again recently and managed to finish it.

 

The idea of the game is you have to collect cargo from an asteroid belt and deliver to the landing pad. You can land without the cargo but you get less points. There's the possibility to refuel as well. There are different planets and moons to land on. At the end of the game a table is presented of your scores for each planet or moon. The engines of the landers are designed for each particular gravity. So for the moon the engines are quite weak and slow to accelerate the lander. So that needs to be taken into account when moving around.

 

The name of the file on the disk is CARGO.

 

Listing is below in the spoiler thing.

 

Spoiler


100 A$(8)="00000000000000FF"
110 A$(7)="000000000000FF"
120 A$(6)="0000000000FF"
130 A$(5)="00000000FF"
140 A$(4)="000000FF"
150 A$(3)="0000FF"
160 A$(2)="00FF"
170 A$(1)="FF"
180 RESTORE 4220
190 FOR I=1 TO 22
200 READ C1,C2$
210 CALL CHAR(C1,C2$)
220 NEXT I
230 CALL CLEAR
240 CALL SCREEN(11)
250 PRINT "  C A R G O  L A N D E R":::::
260 PRINT "COLLECT THE CARGO AND TAKE"::
270 PRINT "IT TO THE LANDING PAD"::
280 PRINT "E MAXIMUM THRUST"
290 PRINT "W MEDIUM THRUST"
300 PRINT "X ZERO THRUST"
310 PRINT "S LEFT"
320 PRINT "D RIGHT"::
330 PRINT "PAD TURNS RED IF GOING UP"::
340 PRINT "GO SIDEWAYS LANDER TURNS RED":::::
350 PRINT "  P R E S S  A N Y  K E Y"
360 CALL KEY(0,K,S)
370 IF S=0 THEN 360
380 CALL CLEAR
390 PLANET=0
400 DIFFI=2
410 TIME=65*(4-DIFFI)
420 REM  
430 CALL SCREEN(2)
440 TOTAL=MASS(1)+MASS(2)+MASS(3)+MASS(4)+MASS(5)+MASS(6)+MASS(7)+MASS(8)
450 PLANET=PLANET+1
460 IF PLANET=9 THEN 1070 ELSE 560
470 PRINT ::::"TOTAL SCORE:";INT(TOTAL):::
480 PRINT "SCORE BREAKDOWN:"::
490 FOR I=1 TO 8
500 PRINT PLNT$(I);" ";TAB(11);INT(MASS(I))
510 MASS(I)=0
520 NEXT I
530 PRINT ::::
540 INPUT "PRESS ENTER TO PLAY AGAIN":B$
550 GOTO 390
560 ON PLANET GOTO 570,630,700,760,830,890,960,1020
570 PLNT$(1)="MERCURY"
580 M_PLANET=3.3E23
590 SURFAC=2.44E6
600 SKY=2
610 SUR=5
620 GOTO 1070
630 PLNT$(2)="VENUS"
640 M_PLANET=4.87E24
650 SURFAC=6.05E6
660 SKY=11
670 SKY2=12
680 SUR=7
690 GOTO 1070
700 PLNT$(3)="THE MOON"
710 M_PLANET=7.35E22
720 SURFAC=1.74E6
730 SKY=2
740 SUR=15
750 GOTO 1070
760 PLNT$(4)="MARS"
770 M_PLANET=6.418542E23
780 SURFAC=3389920
790 SKY=10
800 SKY2=9
810 SUR=7
820 GOTO 1070
830 PLNT$(5)="IO"
840 M_PLANET=8.93E22
850 SURFAC=1.81E6
860 SKY=2
870 SUR=12
880 GOTO 1070
890 PLNT$(6)="TITAN"
900 M_PLANET=1.35E23
910 SURFAC=2.58E6
920 SKY=4
930 SKY2=3
940 SUR=9
950 GOTO 1070
960 PLNT$(7)="TITANIA"
970 M_PLANET=3.49E21
980 SURFAC=0.79E6
990 SKY=2
1000 SUR=8
1010 GOTO 1070
1020 PLNT$(8)="TRITON"
1030 M_PLANET=2.14E22
1040 SURFAC=1.35E6
1050 SKY=15
1060 SUR=16
1070 IF PLANET>1 THEN 1080 ELSE 1130
1080 IF (PLANET>1)*(MASS(PLANET-1)>0)THEN 1090 ELSE 1130
1090 P$="POINTS FOR LANDING ARE "&STR$(POINTS+GBARS*1000)
1100 Y=3
1110 X=19
1120 GOSUB 2900
1130 IF PLANET=9 THEN 470
1140 GBARS=0
1150 V1=10
1160 V2=5
1170 M_LDR=50000.0
1180 FUEL=12000.0
1190 M=M_LDR
1200 MAXT=300000
1210 ISP=327.0*9.81
1220 W=0.0
1230 V=V1
1240 ALT=980
1250 TH_ALT=1000
1260 TK=1
1270 PI=4*ATN(1)
1280 FOR I=1 TO 16
1290 CALL COLOR(I,16,1)
1300 NEXT I
1310 G=6.67E-11*M_PLANET/SURFAC^2
1320 MAXT=INT(M_LDR*(G+V1*V1/TH_ALT))*(4-DIFFI)
1330 FUEL=INT((TIME*MAXT/ISP)/2)
1340 PMASS=M_LDR-FUEL
1350 PRINT :::"GET READY FOR ";PLNT$(PLANET):::
1360 IF G>3.3 THEN 1380
1370 PRINT PLNT$(PLANET);" HAS LOW GRAVITY":::
1380 IF (G>3.3)*(G<6.6)THEN 1390 ELSE 1400
1390 PRINT PLNT$(PLANET);" HAS MEDIUM GRAVITY":::
1400 IF G>6.6 THEN 1410 ELSE 1420
1410 PRINT PLNT$(PLANET);" HAS HIGH GRAVITY":::
1420 M_BAR=FUEL*0.5
1430 POINTS=PLANET*100
1440 PRO$=""
1450 INPUT "PRESS ENTER TO PROCEED":PRO$
1460 IF PRO$="" THEN 1470 ELSE 1450
1470 SC=INT(TH_ALT/22)
1480 SC2=INT(60/12)
1490 WR=ABS(W*SURFAC)
1500 DR=INT(RND*30*SC)+1
1510 OLD_DR=DR
1520 OLD_ALT=ALT
1530 ZOOM=0
1540 CALL CLEAR
1550 CALL SCREEN(SKY)
1560 FOR I=1 TO 16
1570 CALL COLOR(I,16,1)
1580 NEXT I
1590 CALL COLOR(14,14,1)
1600 CALL COLOR(12,SUR,1)
1610 CALL COLOR(11,9,1)
1620 GOSUB 3010
1630 CALL CHAR(145,"18244281817E42E7")
1640 IF (PLANET=1)+(PLANET=3)+(PLANET=5)+(PLANET=7)+(PLANET=8)THEN 1650 ELSE 1660
1650 CALL CHAR(145,"3C42423C427E42E7")
1660 CALL COLOR(15,16,1)
1670 CALL CHAR(152,"FEFEFEFEFEFEFE00")
1680 CALL COLOR(16,16,1)
1690 P$="FUEL:"
1700 Y=1
1710 X=1
1720 GOSUB 2900
1730 P$="FINE POS Y:  X:"
1740 Y=1
1750 X=2
1760 GOSUB 2900
1770 DT=1
1780 V_DESC=0
1790 OLD_ALT=ALT
1800 REM     START    
1810 CALL KEY(0,K,S)
1820 IF K=ASC("D")THEN 1830 ELSE 1840
1830 WR=WR+10
1840 IF K=ASC("S")THEN 1850 ELSE 1860
1850 WR=WR-10
1860 IF ABS(WR)>0 THEN 1870 ELSE 1890
1870 CALL COLOR(15,7,1)
1880 GOTO 1910
1890 IF WR=0 THEN 1900 ELSE 1910
1900 CALL COLOR(15,16,1)
1910 DV=V-V1
1920 IF V>0 THEN 1930 ELSE 1940
1930 CALL COLOR(11,16,1)
1940 IF V<=0 THEN 1950 ELSE 1960
1950 CALL COLOR(11,9,1)
1960 IF V<V1 THEN 1970 ELSE 1990
1970 THRUST=0
1980 GOTO 2020
1990 THRUST=TK*(DV/DT+G)*M
2000 IF THRUST>MAXT THEN 2010 ELSE 2020
2010 THRUST=MAXT
2020 IF (M_LDR-M)>=FUEL THEN 2030 ELSE 2070
2030 THRUST=0
2040 TK=0
2050 M=M_LDR-FUEL
2060 GOTO 2160
2070 IF K=ASC("E")THEN 2080 ELSE 2090
2080 THRUST=MAXT
2090 IF K=ASC("X")THEN 2100 ELSE 2110
2100 THRUST=0
2110 IF K=ASC("W")THEN 2120 ELSE 2130
2120 THRUST=MAXT*0.5
2130 A=THRUST/M
2140 CALL COLOR(14,1-15*(THRUST>0),1)
2150 CALL SOUND(-2000,-7,30-THRUST*30/MAXT)
2160 V=V+G*DT
2170 A=THRUST/M
2180 V=V-A*DT
2190 ALT=ALT-V*DT
2200 IF ALT>1000 THEN 2210 ELSE 2230
2210 ALT=1000
2220 V=V1
2230 DR=DR+WR
2240 RATE=THRUST/ISP
2250 M=M-TK*RATE*DT
2260 IF ((ALT-PAD)>60)*(ZOOM=0)THEN 2270 ELSE 2290
2270 GOSUB 3460
2280 GOTO 2320
2290 IF (XPOS>=15)*(XPOS<=17)THEN 2300 ELSE 2270
2300 IF (ALT-PAD)<=5 THEN 2330
2310 GOSUB 3780
2320 GOTO 1800
2330 IF OBJ=112 THEN 2350 ELSE 2340
2340 IF (OBJ=120)+(OBJ=121)+(OBJ=122)+(OBJ=123)THEN 2450
2350 IF ZOOM=1 THEN 2360 ELSE 2390
2360 CALL HCHAR(YPOS,1,32,32)
2370 CALL CHAR(42,A$(1))
2380 CALL HCHAR(13,1,42,32)
2390 IF V>V2 THEN 2450
2400 CALL SOUND(150,2000,0)
2410 P$="WELCOME TO "&PLNT$(PLANET)
2420 POINTS=INT((FUEL-(M_LDR-M))*1000/FUEL)
2430 MASS(PLANET)=POINTS+GBARS*1000
2440 GOTO 2530
2450 IF ZOOM=0 THEN 2510
2460 CALL HCHAR(1,6,96,INT(V))
2470 CALL HCHAR(12,15,103,3)
2480 CALL HCHAR(11,15,32,3)
2490 CALL HCHAR(10,15,32,3)
2500 GOTO 2520
2510 CALL HCHAR(YPOS,XPOS,103)
2520 P$="CRASH ON "&PLNT$(PLANET)
2530 X=17
2540 Y=7
2550 GOSUB 2900
2560 FOR DELAY=1 TO 500
2570 NEXT DELAY
2580 TIME=TIME-(3-DIFFI)*8
2590 GOTO 420
2600 RESTORE 4290
2610 FOR I=1 TO 6
2620 READ C1,C2$
2630 CALL CHAR(C1,C2$)
2640 NEXT I
2650 CALL HCHAR(Y,X,152)
2660 CALL HCHAR(Y,X+1,153)
2670 CALL HCHAR(Y+1,X,154)
2680 CALL HCHAR(Y+1,X+1,155)
2690 CALL HCHAR(Y+2,X,156)
2700 CALL HCHAR(Y+2,X+1,157)
2710 CALL HCHAR(Y+3,X,138)
2720 CALL HCHAR(Y+3,X+1,139)
2730 RETURN
2740 RESTORE 4310
2750 FOR I=1 TO 9
2760 READ C1,C2$
2770 CALL CHAR(C1,C2$)
2780 NEXT I
2790 CALL HCHAR(Y,X,151)
2800 CALL HCHAR(Y,X+1,152)
2810 CALL HCHAR(Y,X+2,153)
2820 CALL HCHAR(Y+1,X,154)
2830 CALL HCHAR(Y+1,X+1,155)
2840 CALL HCHAR(Y+1,X+2,156)
2850 CALL HCHAR(Y+2,X,157)
2860 CALL HCHAR(Y+2,X+1,158)
2870 CALL HCHAR(Y+2,X+2,159)
2880 CALL HCHAR(Y+3,X+1,137)
2890 RETURN
2900 FOR J=1 TO LEN(P$)
2910 IF Y<=32 THEN 2940
2920 Y=1
2930 X=X+1
2940 IF X<=24 THEN 2960
2950 X=1
2960 CH=ASC(SEG$(P$,J,1))
2970 CALL HCHAR(X,Y,CH)
2980 Y=Y+1
2990 NEXT J
3000 RETURN
3010 TOP=0.7
3020 J=2
3030 OLD_J=J
3040 DIR=1
3050 DIR2=1
3060 DT=1
3070 FOR I=1 TO 32
3080 IF (I>=15)*(I<=17)THEN 3090 ELSE 3140
3090 CH=112
3100 IF (DIR=-1)*(J>2)THEN 3110 ELSE 3120
3110 J_PLOT=J-1
3120 PAD=J_PLOT*SC
3130 GOTO 3270
3140 R=RND
3150 IF R>TOP THEN 3160 ELSE 3180
3160 DIR=-DIR
3170 J=J-DIR
3180 IF J+DIR>11 THEN 3080
3190 J=J+DIR
3200 CH=121+DIR
3210 IF J<2 THEN 3220 ELSE 3230
3220 J=2
3230 IF (J=OLD_J)*(R<=TOP)THEN 3240 ELSE 3260
3240 J=OLD_J
3250 CH=121
3260 J_PLOT=J
3270 CALL HCHAR(25-J_PLOT,I,CH)
3280 IF (DIR<>DIR2)*(DIR=-1)*(I>1)THEN 3290 ELSE 3320
3290 IF (PLANET=2)+(PLANET=5)THEN 3300 ELSE 3320
3300 CALL HCHAR(25-J_PLOT,I-1,125)
3310 CALL HCHAR(25-J_PLOT,I,126)
3320 CALL VCHAR(25-J_PLOT+1,I,124,J_PLOT-1)
3330 DIR2=DIR
3340 IF (CH=120)*((25-J_PLOT+2)<25)THEN 3350 ELSE 3360
3350 CALL VCHAR(25-J_PLOT+2,I,123)
3360 CALL HCHAR(INT(5*RND)+5,I,INT(RND*4)+98)
3370 OLD_J=J
3380 NEXT I
3390 CALL COLOR(13,5,1)
3400 CALL COLOR(10,14,1)
3410 FOR I=1 TO 1-(PLANET>=4)-(PLANET>=7)
3420 CALL HCHAR(10,-10*(I=1)-20*(I=2)-(I=3)+INT(RND*10),104)
3430 CALL HCHAR(9,-10*(I=1)-20*(I=2)-(I=3)+INT(RND*10),128)
3440 NEXT I
3450 RETURN
3460 CALL VCHAR(24-INT(OLD_ALT/SC),INT(OLD_DR/SC)+1-OS,32,SPC)
3470 IF DR/SC>OS+32 THEN 3480 ELSE 3510
3480 OS=OS+32
3490 CALL HCHAR(4,1,32,672)
3500 GOSUB 3010
3510 OLD_ALT=ALT
3520 OLD_DR=DR
3530 YPOS=24-INT(OLD_ALT/SC)
3540 XPOS=INT(DR/SC)+1-OS
3550 CALL GCHAR(YPOS+1,XPOS,EXHAUST)
3560 CALL GCHAR(YPOS,XPOS,OBJ)
3570 IF (OBJ=112)+(OBJ=120)+(OBJ=121)+(OBJ=122)+(OBJ=123)THEN 2330
3580 IF (OBJ>=98)*(OBJ<=101)THEN 2450
3590 IF (OBJ=104)+(OBJ=128)+(OBJ=129)THEN 3600 ELSE 3650
3600 M=-M_LDR*(OBJ=104)-(M+M_BAR)*(OBJ=128)
3610 M_LDR=M_LDR-(M_BAR)*(OBJ=128)
3620 GBARS=GBARS-(OBJ=128)-(OBJ=129)
3630 CALL SOUND(300,200,0)
3640 CALL SOUND(300,800,0)
3650 CALL HCHAR(YPOS,XPOS,145)
3660 SPC=1
3670 IF (EXHAUST<>32)+(THRUST=0)THEN 3710
3680 CALL HCHAR(1+YPOS,XPOS,136)
3690 CALL COLOR(14,1-13*(THRUST>0),1)
3700 SPC=2
3710 CALL HCHAR(2,12,48+(OLD_ALT/SC-INT(OLD_ALT/SC))*10)
3720 CALL HCHAR(2,16,48+(DR/SC-INT(DR/SC))*10)
3730 CALL HCHAR(1,6,97,27)
3740 BAR_L=INT((FUEL-(M_LDR-M))*27/FUEL)
3750 IF BAR_L<1 THEN 3770
3760 CALL HCHAR(1,6,152,BAR_L)
3770 RETURN
3780 IF ZOOM=0 THEN 3790 ELSE 4060
3790 IF ABS(WR)>0 THEN 2450
3800 PRINT :::"PROCEEDING TO ZOOM VIEW":::::::::::::
3810 CALL CLEAR
3820 X=15
3830 Y=10
3840 DT=0.5
3850 IF (PLANET=2)+(PLANET=4)+(PLANET=6)THEN 3860 ELSE 3950
3860 FOR I=1 TO 16
3870 CALL COLOR(I,SUR,1)
3880 NEXT I
3890 CALL COLOR(13,16,1)
3900 CALL COLOR(15,16,1)
3910 CALL COLOR(16,16,1)
3920 CALL SCREEN(SKY)
3930 GOSUB 2740
3940 GOTO 3980
3950 CALL COLOR(10,SUR,1)
3960 CALL COLOR(2,SUR,1)
3970 GOSUB 2600
3980 YPOS_OLD=24
3990 P$="VEL:                      20"
4000 X=1
4010 Y=1
4020 GOSUB 2900
4030 ZOOM=1
4040 V1=10
4050 MAXT=INT(M_LDR*(G+400/TH_ALT))*1.2
4060 YPOS_OLD=YPOS
4070 YP=(ALT-PAD)/SC2
4080 YPOS=12+INT(YP)
4090 IF YPOS>24 THEN 4100 ELSE 4110
4100 YPOS=24
4110 XPOS=INT(DR/SC)+1-OS
4120 FINE=INT((YP-INT(YP))*8)+1
4130 IF (YPOS<>YPOS_OLD)*(YPOS>12)THEN 4140 ELSE 4150
4140 CALL HCHAR(YPOS_OLD,1,32,32)
4150 CALL CHAR(42,A$(FINE))
4160 CALL HCHAR(YPOS,1,42,32)
4170 IF (V<=20)*(V>=1)THEN 4180 ELSE 4210
4180 CALL HCHAR(1,6,97,20)
4190 CALL HCHAR(1,6,96,INT(V))
4200 CALL COLOR(9,-SUR*(V>5.0)-16*(V<=5),1)
4210 RETURN
4220 DATA 96,FEFEFEFEFEFEFE00,97,FE8282828282FE00,98,3C46472322241800,99,0018384830000000
4230 DATA 100,3C7E9F8F8781720C,101,3078544424180000,103,C0DB1B00C3DB18C3,104,007CC6DECEDEDE7C
4240 DATA 112,FF10101038383838,121,00000000000000FF
4250 DATA 123,7FBFDFEFF7FBFDFE,124,FFFFFFFFFFFFFFFF,128,007CC6BEBEBEC67C,129,001818303C30101C
4260 DATA 136,003C3C3C18181800,137,00A5915A42242408,138,0A0A090504020200,139,505010A020404080
4270 DATA 126,0000000000040E3F,125,00000000002070FC
4280 DATA 120,80C0E0F0F8FCFEFF,122,0103070F1F3F7FFF
4290 DATA 152,0000000003070B13,153,00000000C0E0D0C8,154,131F1F0F07030F0F,155,C8F8F8F0E0C0F0F0
4300 DATA 156,3F5F7F5F414343E0,157,FCFAFEFA82C2C207
4310 DATA 151,0000010103030706,152,7FFFFFFFFFFFFF7F,153,0080C0C0E0E0F030,154,0C0C1F1F3F3F7F7F
4320 DATA 155,7F7FFFFFFFFFFFFF,156,1818FCFCFEFEFFFF,157,7F1F030202020F0F,158,FFFFFF0000008080
4330 DATA 159,FFFCE0202020F8F8

 

 

 

 

Classic99 QI399.063 10.8.2023 17_36_48.png

Classic99 QI399.063 10.8.2023 17_37_14.png

CARGO.zip

Cargo.dsk

Edited by tibasic
  • Like 14
  • Thanks 1
Link to comment
Share on other sites

Thanks sometimes99er for giving it a whirl! There's no levels as such as the 'levels' are of similar difficulty. What I could do is only let the player advance to the next planet or moon once they have completed the preceding screen. 

 

I forgot to mention the lander has an autopilot for the vertical velocity. This limits the lander's descent rate to 10 m/s and is on unless a thrust key is pressed. This was to make it a bit easier to play and so the player can spend some time planning their route through the asteroid belt or rather asteroid maze. 

  • Like 2
Link to comment
Share on other sites

2 minutes ago, tibasic said:

Thanks sometimes99er for giving it a whirl! There's no levels as such as the 'levels' are of similar difficulty. What I could do is only let the player advance to the next planet or moon once they have completed the preceding screen. 

 

I forgot to mention the lander has an autopilot for the vertical velocity. This limits the lander's descent rate to 10 m/s and is on unless a thrust key is pressed. This was to make it a bit easier to play and so the player can spend some time planning their route through the asteroid belt or rather asteroid maze. 

At second run, I gathered it might be a kind of a "maze", but really didn't think so. Kinda strange in a way. 😬
 

  • Like 1
Link to comment
Share on other sites

10 minutes ago, sometimes99er said:

At second run, I gathered it might be a kind of a "maze", but really didn't think so. Kinda strange in a way. 😬
 

Yeah I don't know what it is really ... 😀

 

12 minutes ago, Retrospect said:

Excellent!  Another good one to add to my TI Basic game collection :)

Great, thanks!

  • Like 3
Link to comment
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...
  • Recently Browsing   0 members

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