Half-Byte Tiny Basic Type In Game: Invader

WP_20140719_003Yep, I use ‘Invader’ a lot. Here’s a version, just for Half-Byte Tiny Basic. It features Wii Nunchuck support, sound and AWESOME graphics! Just awesome!

100 CLS
110 X=0:Y=0:D=1:Z=75
120 LINE 0,38,79,38,1
130 B=9:C=5:U=4:V=0
140 CURSOR 0,7:?”Score:”;
150 GOSUB 800
160 GOSUB 900
170 P=PAD(3)
180 IF P=1 S=1
185 IF P=1 TONE 1024,100
190 IF S=1 GOSUB 700
290 GOTO 150
700 CURSOR B,U:?CHR(142);
710 DELAY Z:CURSOR B,U:?”  “;
720 U=U-1
730 IF U<1 IF B<>X U=4:S=0
740 IF U<1 IF B=X GOSUB 1000
790 RETURN
800 CURSOR B,C:?CHR(151);
890 RETURN
900 CURSOR X,Y:?CHR(152);:DELAY X:CURSOR X,Y:?CHR(153);:DELAY Z:CURSOR X,Y:?”  “;
910 X=X+D:IF X>17 D=-1:X=17
920 CURSOR X,Y:?”  “;
930 IF X<2 D=1:X=2
990 RETURN
1000 CURSOR B,U:?”*”;:DELAY 3*X:CURSOR B,U:?” “;:DELAY 3*Z:?”*”;:DELAY 3*Z:CURSOR B,U:?” “;
1010 S=0:V=V+100
1020 CURSOR 0,7:?”Score:”,V;
1030 U=4
1040 TONE 2,400
1090 RETURN

There’s room let to add code to move your ‘tank’ and, perhaps, have the moon guy shoot back.

It is a simple little, but I found it a bit difficult to shoot the moon guy.  The rules are simple: use the ‘Z’ button on the Wii Nunchuck to fire a missile at the moon guy. You get 100 points for each hit. Play continues until you get bored.  Tinker with the code, add more gameplay and share it with us.

Have fun!

Advertisements

2 thoughts on “Half-Byte Tiny Basic Type In Game: Invader

  1. You can make your tank move by doing the following:
    ADD:
    175 Q=PAD(0)

    200 IF Q>200 GOSUB 600
    210 IF Q200 I=1
    620 IF Q<200 I=-1
    630 B=B+I
    640 IF B17 B=17
    660 GOSUB 800
    690 RETURN

    And, to ‘win’ the game:
    1050 IF V>1000 CLS:PRINT “You Won!”:STOP

    Next, I’ll add some code to make the moon guy shoot back.
    Please post any changes you make, we’d all be interested in them.

  2. Looks like some of my code was left out of the comment. Line 200 should be:
    200 IF Q>200 GOSUB 600
    210 IF Q200 I=1
    620 IF Q<200 I=-1
    630 B=B+I
    640 IF B17 B=17
    660 GOSUB 800
    690 RETURN

    Other thoughts:
    In line 175 from my comments above, you could have it read the accelerometer instead of the thumbstick:
    175 Q=PAD(4)
    Line 610 would read:
    610 IF Q>128 I=1
    620 IF Q<127 I=-1

    Substitute 128 for 200 in line 200
    Substitute 127 for 200 in line 210

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s