Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //02/14/23 v1.1
- 15->W //speed of asteroids - set to a factor of 150
- ClrHome
- 2->X //player X
- 5->Y //player Y
- 3->L //starting live #
- 0->S //resets score
- ">"->Str1 //player sprite
- "*"->Str2 //asteroid sprite
- 16-round(0/10,0)->R //sets initial asteroid X posistion
- randInt(2,8)->E //sets initial asteroid Y posistion
- getKey->K
- 0->N //resets loop variable
- Repeat K=45 or L<=0
- If Y=E and X=R //collision for player and asteroid
- Then
- 0->N
- randInt(2,8)->E
- S+1->S //increases score
- End
- E->Q //stores asteroid Y pos before it is set for the frame
- If N>=150 //resets loop once it is 150 (touches the left of the screen)
- Then
- 0->N
- randInt(2,8)->E
- L-1->L
- End
- getKey->K
- Y->F //stores player Y pos before it is set for the frame
- If K!=0 //key detection 25 is up 34 is down (sets player Y)
- Then
- If K=25
- Then
- If Y>2
- Then
- Y-1->Y
- End
- Else
- If K=34
- Then
- If Y<8
- Then
- Y+1->Y
- End
- End
- End
- End
- N+W->N //increases loop by speed (W)
- R->O //sets asteroid X pos before it is set for the frame
- 16-round(N/10,0)->R //sets asteroid X posistion
- If O!=R or F!=Y or Q!=E //checks for any changes in posistion from the last frame
- Then
- If Q!=E
- Then
- Output(Q,O," ") //clears old asteroid posistion when it reaches the end
- End
- If O!=R
- Then
- Output(E,O," ") //clears old asteroid posistion
- End
- If F!=Y
- Then
- Output(F,X," ") //clears old player posistion
- End
- Output(Y,X,Str1)
- Output(E,R,Str2)
- For(I,1,3) //displays lives
- If I<=L
- Then
- Output(1,I+12,Str1)
- Output(1,L+13," ")
- // Output(1,L+13," ")
- End
- End
- Output(1,2,S) //displays score
- End
- End
- ClrHome
- Output(4,4,"GAME OVER") //game over screen
- Output(3,5,"SCORE=")
- Output(3,11,S)
- " //prevents DONE from appearing when the program finishes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement