A downloadable game

****STAR PADS****

Category: PUR256

Platform: C64

Emulator: Hoxs64 works, Vice has sometimes issues with 256 columns

INSTRUCTIONS

In a hypothetical Star Wars multiverse you are a Jedi that can prevent Death Star to destroy Alderaan. In order to avoid this tragedy you have to defeat the guardian Sith in a lightsaber duel, trying to hit an energy ball with your lightsaber and launching it behind the enemy. He will do the same, of course. Depending on where the ball goes, the verdict.

The Sith enemy is more trained than you, you are a little more than an apprentice (like Luke when challenging Darth Vader), so he can use some Force power to confuse you.

This is the most difficult part of this Pong game: when the ball is on enemy's side, he can invert your commands on the paddle, so up becomes down and down becomes up.

When he is using this power, the screen frame turns to white and an "I" appears in the top middle of the screen.

That's all, use the Force!+

* * *  STARPADS * * * 

CODE AND COMMENTS

LINE 0: it defines some vars, particularly the one to print the paddle (b$). Then it starts to init some sprites registers. There are 4 multicolour / double height and width sprites used to print the Death Star.

LINE 1: some vars and printing of the title screen (with gosub to 8 and 9, see later) and printing of the battlefield.

LINE 2: here starts the main loop. The pO1044,32+23*(i<0) prints an "I" in the top middle if i=-1 that is if we are in inverted commands mode (see instructions). Then we read the joystick into j and change player's paddle Y accordingly to it and to the inversion factor "i" described before. Then some bounds checks and DATAs. DATAs are put also in the end of other lines.

LINE 3: it prints the 2 paddles in their positions (y and xp for player's pad, e and xe for AI paddle).The ending if is to invert the ball's horizontal direction "u" if it hits the player's paddle. It updates also player's score.

LINE 4: pOm+40*c+b,32 prints a space in ball's previous cohordinates b and c. Then it checks if it have hit enemy's paddle, changing ball's horizontal direction. It also updates enemy's score, but I decided to not show scores on inplay session in order to not slow the game.

LINE 5: pOn,2+i: changes the screen corner color according to inversion mode on or off.Then I print the ball in its cohordinates w and z, and I update b and c (previous cohordinates) after that. Than I update the ball's horizontal cohordinate w accordingly to  the direction u. Then with v=v*(1+2*(z>21orz<2)) I update vertical direction v accordingly to top and buttom bounds reached by the ball. Finally, with ifb>xe I check if the ball has overcame enemy's paddle and I show a sort of Yoda telling you winning and wait to press enter in order to restart the game.

LINE 6: I update the ball's vertical cohordinate z accordingly to direction v. Then there is a little of AI to move enemy's paddle with instructions e=e-((z<e+3)-(z>e+3))*(u=-1orw>20-4*rN(.)):e=-e*(e>0):ife>18tHe=18 . In particular, I move the bar toward the ball only if the ball is in a random portion of opponent's side and it is moving towards it.

LINE 7: simply, with i=2*(w>20aNrN(.)>.1)+1 I get a random inversion factor's change only if the ball is in opponent's side (it would be too difficult to have it while the ball is in own side). Then if we haven't loose yet we goto to main loop start with instruction on2+(w>=xp)gO2. If not, we print the game over sequence, with a simple laser animation starting from death star.

LINE 8 and 9: as said, they print the title string and do sprites loading. Checking if location 2040 is equals to 13 we can avoid to run this portion of code from the second run towards.


* * THE WHOLE CODE * *
0n=53280:sy=65520:i=1:xp=11:xe=29:b$=" {down}{left}{reverse on}{cm g}{down}{left}{cm g}{down}{left}{cm g}{down}{left}{cm g}{down}{left}{reverse off} ":p=56320:y=12:w=20:z=13:v=53248:pOv+21,15:pOv+37,15:pOv+38,12:fOt=0to3:pOv+39+t,11:nE:pOv+29,15:pOv+23,15:pOv,70:pOv+1,80:pOv+2,118:pOv+3,80:pOv+4,70:pOv+5,122:pOv+6,118:pOv+7,122:pOv+33,0:pOv+27,15
1?"{clear}":goS8:u=1:v=1:m=1024:e=12:fOt=0to39:pOm+t,102:pOm+t+920,102:nE:dA0,0,42,0,0,170,0,2,170,0,10,170,0,42,170,0,170,170,0,170,170,2,170,170,2,170,170,10,170,170,10,170,170,42,170,170,42,170,170,42,170,170,42,170,170,170,170,168,170,170,168,170,170,168,170
2pO1044,32+23*(i<0):j=pE(p):y=y+(j=126)*i:y=y-(j=125)*i:y=-y*(y>0):ify>=18tHy=18:dA170,168,170,170,168,0,0,0,172,0,0,175,0,0,171,192,0,171,240,0,171,244,0,171,245,0,171,253,0,171,253,64,171,253,64,171,253,80,171,253,80,171,253,84,170,253,84,2,255,84,48,255
3pO780,0:pO781,y:pO782,xp:sYsy:?b$:pO780,0:pO781,e:pO782,xe:sYsy:?b$:ifw=xp+1aN(z>=yaNz<y+5)tHu=-u:s=s+1:dA84,252,63,85,255,63,85,231,63,85,219,63,85,219,63,85,219,0,0,170,170,168,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,42,170,170
4pOm+40*c+b,32:ifw=xe-1aN(z>=eaNz<e+5)tHu=-u:es=es+1:dA42,170,170,42,170,170,42,170,170,10,170,170,10,170,170,2,170,170,2,170,170,0,170,170,0,170,170,0,42,170,0,10,170,0,2,170,0,0,170,0,0,42,231,63,85,254,63,85,60,191,85,130,191,85,170
5pOn,2+i:pO780,0:pO781,z:pO782,w:sYsy:?"Q":b=w:c=z:w=w+u:v=v*(1+2*(z>21orz<2)):ifb>xetH?"{clear}    {light green}{162}{162}   remember, a jedi's strength{return}  {172}{reverse on}{160}{160}{160}{160}{reverse off}{187}   flows from the force!{return} {green}{127}{reverse on}{160}{183}{172}{187}{183}{160}{reverse off}{169}{return}  {188}{reverse on}{160}{160}{160}{160}{reverse off}{190}   your score:"+stR(s)+"{return}   {reverse on}{187}{183}{183}{172}{return}{return}press enter":inputa$:rU
6z=z+v:e=e-((z<e+3)-(z>e+3))*(u=-1orw>20-4*rN(.)):e=-e*(e>0):ife>18tHe=18:dA255,85,170,255,85,170,255,84,171,255,84,171,255,84,171,253,84,171,253,80,171,253,80,171,253,64,171,253,64,171,253,0,171,253,0,171,252,0,171,240,0,171,192,0,171,0,0,168,0,0
7i=2*(w>20aNrN(.)>.1)+1:on2+(w>=xp)gO2:?"{clear} {dark gray}{172}{reverse on}{163}{163}{reverse off}{187}  you have failed{return} {reverse on}{165}{168}{168}{170}{reverse off} for the last time{return} {reverse on}BWWB{return}{182}{reverse on}M{reverse off}{169}{127}{reverse on}N{reverse off}{181}{return}{188}{reverse on}{162}{163}{163}{162}{reverse off}{190}{return}{return}{yellow}hit enter":fOt=1to200:nE:?"{home}{return}{return}{return}{return}{return}{return}{return}"sP13)"{green}ED{sh asterisk}R{down}{left*4}{sh asterisk*4}>{down}{left*5}RF{sh asterisk}D":fOt=1to22:pO1361+t,64:pO55633+t,5:nE:pOn+1,1:pOn+1,0:inputa$:rU
8s$="{yellow}UE{reverse on}{162}{172}{reverse off}{190}{reverse on}{172}{187}{reverse off} {reverse on}{172}{reverse off}{187}{return}JI {161} {reverse on}{172}{187}{reverse off} {reverse on}{172}{reverse off}{187}{return}CK {190} {190}{188} {190}{190}{return}{176}I     UD{return}{171}K{reverse on}{172}{187}{reverse off} {reverse on}{172}{reverse off}{187}JI{return}{125} {reverse on}{172}{187}{reverse off} {reverse on}{188}{reverse off}{190}FK{return}":d=2040:ifpE(d)<>13tHpOd,13:pOd+1,14:pOd+2,15:pOd+3,192:pOv+28,15:fOt=1to3:fOq=0to62:rEa:pO64*(12+t)+q,a:nE:nE:fOq=0to62:rEa:pOq+(192*64),a:nE:?"{home}":fOt=1to20:?"":nE:?""
9s$(0)=s$:s$(1)="{yellow}{reverse on}star pads":s$(2)="{reverse on}in a galaxy far far away":s$(3)="{reverse on}an 8 bit system is burning":s$(4)="{reverse on}doing things it was not intended for":s$(8)="{reverse on}hit enter":l=-(40-len(s$(g)))*(g>0):?sPl/2)s$(g):g=g-(g<8):gEa$:fOt=0to200:nE:on2+(a$="")gO9:?"{clear}":reT
20rem y=y player paddle y, w and z balls cohordinates, b and c previous balls cohordinates, e=enemy paddle y
30rem u = 1 if ball going right, -1 if left, v=1 if ball going up,-1 if down,s=score,es=enemy score. i=inversion factor



Download

Download
starpads.prg 2 kB
Download
starpads.mp4 1 MB
Download
instructions.txt 985 bytes
Download
starpadcode.txt 6 kB
Download
code_screenshot.PNG 31 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.