20 Line Contest: Letter Attack 20

Basic and Machine Language

Moderator: Moderators

Post Reply
yago
Vic 20 Newbie
Posts: 13
Joined: Tue Apr 27, 2004 11:59 am

20 Line Contest: Letter Attack 20

Post by yago »

Letter Attack 20

Save the World from beeing invaded by ugly unearthly Usurpators!
You can destroy the Aliens by pressing the Key for one of the 26 different Space crafts.
There are also 3 Anti-Alien Protection Shields, but the Aliens can destroy those.

The Intention of the Game is to train keyboard usage, and I hope some Kids will also have Fun with it.


This is my first Version, I plan to insert some Sound.
I am not sure, if I have the Time until Deadline, so I better publish this early Version, before not publishing anything at all.

Code: Select all

10 a1$="<grn> <blu> <grn> <blu> <grn> ":a2$="<blu> <grn> <blu> <grn> <blu> "
100 print "<black><clr><down><down><down><down>"
110 for t=1 to 5
111 print "<right><right><rvs on>"a1$"<right><right>"a1$"<right><right>"a1$
112 print "<right><right><rvs on>"a2$"<right><right>"a2$"<right><right>"a2$
115 next:r=7702:f=38422
120 fort=0to20step2:poke8164+t,160:poke38884+t,6
125 poke8165+t,160:poke38885+t,4:next
300 x=int(rnd(0)*24):y=0:c=int(rnd(0)*26)+1:h=0:z=z+1
310 print"<home>score:"s" level:"int(l);
320 p=x+y*22:ifpeek(r+p)=160thenh=1:c=-c:goto370
340 poker+p,c:pokef+p,0:y=y+1:ify>21then900
360 fort=.to20-l:get a$:h=h-(asc(a$+" ")=c+64):next
370 pokef+p,1:poker+p,32:ifhthens=s+c:l=s/150:goto300
399 ifz<1e3goto320
500 print:print "you saved the world!"
900 print:print "game over"
910 if s>h then h=s:input "new highscore,enter   your name";n$
I have also a commented Version, so that one can get through this spaghetti-code.

Have Fun,
Zed Yago
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

For some strange reason I love games that employ the alphabet... remember LadyBug? Anyway. . .

I didn't have a chance to test it out before I noticed the last line. Is the program supposed to loop? The high scorer's name would never be used. N$ is never displayed and would be erased when you run the program again.
High Scores, Links, and Jeff's Basic Games page.
yago
Vic 20 Newbie
Posts: 13
Joined: Tue Apr 27, 2004 11:59 am

Post by yago »

N$ is in fact never really used.
The Idea is to award the highscoring player without wasting too much lines for it.[1] But dont tell anybody!
It can also be seen as an Exercise left to the "Type-In"ner to display or even save the highscore.

The Program loops from line 399 to line 320 (or even more accurate: line 300), as long as z is below 1000. z is the number of fallen down chars.

The commented Version describes the usage of the variables, the program flow etc. But the commented Version is not up to date, and it might bring more confusion.
I hope to update the commented Version and also include some Sound, but due to RL-Stuff, I am not sure if I can make it before Deadline.


[1] Its an Honour to type in your Name, no matter if it is used afterwards.
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

If you get the chance, you may want to type your program into an emulator and save it as a PRG file. It will make it easier for others to save it to disk and/or test it out.
High Scores, Links, and Jeff's Basic Games page.
Guest

Post by Guest »

I do have a .prg of LetterAttack20, but found no way to upload it to this Forum.

But since the deadline has been vanished, I will put together some Files in the near Future..

Have Fun!
yago
Vic 20 Newbie
Posts: 13
Joined: Tue Apr 27, 2004 11:59 am

Post by yago »

That Guest was me, without beeing logged in :-)
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

the file is small. Just email it to me and I will host it here.
High Scores, Links, and Jeff's Basic Games page.
joehicks70
Vic 20 Newbie
Posts: 1
Joined: Tue Feb 28, 2006 4:01 pm

re:letter attack

Post by joehicks70 »

i have typed this program into my vic20, and when i run it, it looks great until, you type the letter, or the letter falls completely, then it gives me a syntax error in line 370, i have checked the whole program, and do not see any typo errors. And line 370 appears to be typed correctly, Can you help? thanks
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Translated to upper case and extra spaces, it should look like this:

Code: Select all

370 POKE F+P,1:POKE R+P,32:IF H THEN S=S+C:L=S/150:GOTO 300
Perhaps you typed S=S+C:1=S/150 which would cause ?SYNTAX ERROR since you can not assign a value (S/150) to a constant (1, one).
Anders Carlsson

Image Image Image Image Image
Post Reply